更新时间:2022-10-31 22:34:49
这是我如何克服上述问题的方式
Here is the way how i overcome from the above issue
public void InsertChargesDetails()
{
UPLCL.Update();
if (TXTSRFID.Text != "")
{
LblAlert.Text = "";
if(TXTVolume.Text!="" && TXTLBuyrate.Text!="" && TXTLSellrate.Text!="" && TXTLRemark.Text!="" && UOMID.Text!="")
{
using (LQTransSeaFreightDataContext DB = new LQTransSeaFreightDataContext())
{
if ((from u in DB.TB_TransSeaLCLs where u.tSLC_VCVolume == TXTVolume.Text && u.tSLC_VCBuyRate == TXTLBuyrate.Text && u.tSLC_VCSellRate == TXTSellRate.Text && u.tSLC_VCRemark == TXTLRemark.Text && u.tSLC_mUOM_NUPKId == mobjGenlib.ConvertLong(UOMID.Text) && u.tSLC_NUIsActive == 1 select u).Count() > 0)
{
ScriptManager.RegisterStartupScript(this, UPLCL.GetType(), "ALERT", "alert('Already Exist');", true);
}
else
{
var newLCL = new TB_TransSeaLCL
{
tSLC_tSEA_NUPKId = mobjGenlib.ConvertLong(TXTSRFID.Text),
tSLC_mUOM_NUPKId = mobjGenlib.ConvertLong(UOMID.Text),
tSLC_VCVolume = TXTVolume.Text,
tSLC_VCBuyRate = TXTLBuyrate.Text,
tSLC_VCSellRate = TXTLSellrate.Text,
tSLC_VCRemark = TXTLRemark.Text,
tSLC_NUIsActive = 1,
tSLC_mCMP_NUUniqueId = mobjGenlib.ConvertLong(TXTCompanyID.Text)
};
DB.TB_TransSeaLCLs.InsertOnSubmit(newLCL);
DB.SubmitChanges();
TB_TransSeaLCL MASACCMULWARR = DB.TB_TransSeaLCLs.OrderByDescending(C => C.tSLC_NUPKId).Where(A => A.tSLC_NUIsActive == 1 && A.tSLC_mCMP_NUUniqueId == mobjGenlib.ConvertLong(TXTCompanyID.Text)).FirstOrDefault();
//Insert In UserLog Report
mobjGenlib.InsertUserlog("tSLC", mobjGenlib.ConvertString(MASACCMULWARR.tSLC_NUPKId), "I");
}
}
}
else
{
ScriptManager.RegisterStartupScript(this, UPLCL.GetType(), "ALERT", "alert('The Fields Should not be left blank');", true);
}
}
}