public ActionResult Save(EXPLCOpening dataSet) { _userId = Convert.ToInt32(Session["UserID"]); _vmMsg = objDalExpLCOpening.Save(dataSet, _userId); return(Json(new { msg = _vmMsg })); }
public ActionResult GetLCDetailInfoByLCID(string LCID) { int id = Convert.ToInt32(LCID); EXP_LCOpening dataSet = repository.ExpLCOpening.GetByID(id); EXPLCOpening ob = new EXPLCOpening(); ob.LCNo = dataSet.LCNo == null ? "" : dataSet.LCNo; ob.LCID = Convert.ToInt32(dataSet.LCID); ob.LCDate = Convert.ToDateTime(dataSet.LCDate).ToString("dd/MM/yyyy"); ob.LCAmount = (decimal)dataSet.LCAmount == null ? 0 : (decimal)dataSet.LCAmount; ob.LCCurrencyID = (byte)dataSet.LCCurrencyID; ob.PIID = dataSet.PIID; ob.PINo = repository.ExpLeatherPI.GetByID(dataSet.PIID == null ? 0 : dataSet.PIID).PINo; ob.LastShipmentDate = Convert.ToDateTime(dataSet.LastShipmentDate).ToString("dd/MM/yyyy"); ob.ExpiryDate = Convert.ToDateTime(dataSet.ExpiryDate).ToString("dd/MM/yyyy"); ob.ExpiryPlace = dataSet.ExpiryPlace == null ? "" : dataSet.ExpiryPlace; ob.RecordStatus = dataSet.RecordStatus; ob.Remarks = dataSet.Remarks; return(Json(ob, JsonRequestBehavior.AllowGet)); }
public ValidationMsg Save(EXPLCOpening dataSet, int _userId) { try { EXP_LCOpening objLcOpening = new EXP_LCOpening(); objLcOpening.LCID = dataSet.LCID; objLcOpening.LCNo = dataSet.LCNo;//DalCommon.GetPreDefineNextCodeByUrl(pageUrl); objLcOpening.LCAmount = dataSet.LCAmount; objLcOpening.LCDate = DalCommon.SetDate(dataSet.LCDate); objLcOpening.LCCurrencyID = dataSet.LCCurrencyID; objLcOpening.PIID = dataSet.PIID == null ? 0 : dataSet.PIID; objLcOpening.ExpiryDate = DalCommon.SetDate(dataSet.ExpiryDate); objLcOpening.ExpiryPlace = dataSet.ExpiryPlace == null ? "" : dataSet.ExpiryPlace; objLcOpening.LastShipmentDate = DalCommon.SetDate(dataSet.LastShipmentDate); objLcOpening.Remarks = dataSet.Remarks; objLcOpening.LCState = "LCOP"; objLcOpening.LCStatus = "GDSP"; objLcOpening.RecordStatus = "NCF"; objLcOpening.RunningStatus = "LCOP"; objLcOpening.SetOn = DateTime.Now; objLcOpening.SetBy = _userId; objLcOpening.IPAddress = GetIPAddress.LocalIPAddress(); //objLcOpening.RefLCNo = dataSet.RefLCNo == null ? "" : dataSet.RefLCNo; //objLcOpening.IssueDate = DalCommon.SetDate(dataSet.IssueDate); //objLcOpening.ExchangeCurrency = dataSet.ExchangeCurrency == null ? 0 : dataSet.ExchangeCurrency; //objLcOpening.ExchangeRate = dataSet.ExchangeRate == null ? 0 : (decimal)dataSet.ExchangeRate; //objLcOpening.ExchangeValue = dataSet.ExchangeValue == null ? 0 : (decimal)dataSet.ExchangeValue; //objLcOpening.NNDSendingTime = dataSet.NNDSendingTime == null ? 0 : (int)dataSet.NNDSendingTime; //objLcOpening.LCANo = dataSet.LCANo == null ? "" : dataSet.LCANo; //objLcOpening.IRCNo = dataSet.IRCNo == null ? "" : dataSet.IRCNo; //objLcOpening.VatRegNo = dataSet.VatRegNo == null ? "" : dataSet.VatRegNo; //objLcOpening.BINNo = dataSet.BINNo == null ? "" : dataSet.BINNo; //objLcOpening.ICNNo = dataSet.ICNNo == null ? "" : dataSet.ICNNo; //objLcOpening.TINNo = dataSet.ICNNo == null ? "" : dataSet.TINNo; //objLcOpening.ICNDate = DalCommon.SetDate(dataSet.ICNDate); //if (dataSet.BranchID != 0) //{ // objLcOpening.LCOpeningBank = dataSet.BranchID; //} //else //{ // objLcOpening.LCOpeningBank = 0; //} //if (dataSet.AdvisingBank != 0) //{ // objLcOpening.AdvisingBank = dataSet.AdvisingBank; //} //if (dataSet.Beneficiary != 0) //{ // objLcOpening.Beneficiary = dataSet.PIBeneficiary; //} //if (dataSet.BeneficiaryAddressID != 0) //{ // objLcOpening.BeneficiaryAddressID = dataSet.BeneficiaryAddressID; //} //objLcOpening.LCReviceNo = dataSet.LCReviceNo; //objLcOpening.LCReviceDate = DateTime.Now; obEntity.EXP_LCOpening.Add(objLcOpening); int flag = obEntity.SaveChanges(); if (flag == 1) { _vmMsg.ReturnId = objLcOpening.LCID; _vmMsg.ReturnCode = objLcOpening.LCNo; _vmMsg.Type = Enums.MessageType.Success; _vmMsg.Msg = "Saved Successfully."; } else { _vmMsg.Type = Enums.MessageType.Error; _vmMsg.Msg = "Saved Faild."; } } catch (DbEntityValidationException e) { StringBuilder sb = new StringBuilder(); foreach (var eve in e.EntityValidationErrors) { sb.AppendLine(string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State)); foreach (var ve in eve.ValidationErrors) { sb.AppendLine(string.Format("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage)); } } throw new DbEntityValidationException(sb.ToString(), e); } return(_vmMsg); }