public void UpdateVideoImageBankLink(VideoImageBank VideoImageBank) { VideoImageBank.Deactivate = "N"; VideoImageBank.ModifiedDate = DateTime.Now; VideoImageBank.DeactivateBy = null; VideoImageBank.DeactivateDate = null; _VideoImageBank.Update(VideoImageBank); }
public void InsertVideoImageBankLink(VideoImageBank VideoImageBank) { VideoImageBank.DeactivateBy = null; VideoImageBank.DeactivateDate = null; _VideoImageBank.Insert(VideoImageBank); }
public IHttpActionResult InsertOtherContract(Contract_Signed_By_Executive OtherContract) { string status = ""; int OtherContractIdId = 0; string OtherContactCode = string.Empty; try { //if (status == "Y") //{ if (OtherContract.Id == 0) { IList <ApplicationSetUp> _ApplicationSetUpList = _ApplicationSetUp.Table.Where(x => x.key == "Other Contract" && x.Deactivate == "N").ToList(); var OtherContractSuggesation = _ApplicationSetUpList.Select(Au => new { OtherContractValue = Au.keyValue, Id = Au.Id }); IList <ContractType> _ContractTypeList = _ContractType.Table.Where(x => x.Id == OtherContract.Contracttypeid && x.Deactivate == "N").ToList(); var ContractType = _ContractTypeList.Select(CT => new { ContractName = CT.ContractName }); OtherContractMaster _OtherContract = new OtherContractMaster(); string stringTokens = ContractType.FirstOrDefault().ContractName; string strVlaue = string.Empty; string[] words; if (stringTokens.Contains("-")) { words = stringTokens.Split('-'); } else { words = stringTokens.Split(' '); } foreach (string word in words) { strVlaue += word.FirstOrDefault(); } _OtherContract.othercontractcode = "OC" + strVlaue.ToString() + OtherContractSuggesation.FirstOrDefault().OtherContractValue; _OtherContract.othercontractcode = _OtherContract.othercontractcode.ToString().ToUpper(); OtherContactCode = _OtherContract.othercontractcode.ToString().ToUpper(); _OtherContract.partyname = OtherContract.partyname; _OtherContract.natureofserviceid = OtherContract.natureofserviceid; _OtherContract.natureofsubserviceid = OtherContract.natureofsubserviceid; _OtherContract.Address = OtherContract.Address; _OtherContract.CountryId = OtherContract.CountryId; _OtherContract.OtherCountry = OtherContract.OtherCountry; _OtherContract.Stateid = OtherContract.Stateid; _OtherContract.OtherState = OtherContract.OtherState; _OtherContract.Cityid = OtherContract.Cityid; _OtherContract.OtherCity = OtherContract.OtherCity; _OtherContract.Pincode = OtherContract.Pincode; _OtherContract.Mobile = OtherContract.Mobile; _OtherContract.Email = OtherContract.Email; _OtherContract.PANNo = OtherContract.PANNo; _OtherContract.Requestdate = OtherContract.Requestdate; _OtherContract.ProjectTitle = OtherContract.ProjectTitle; _OtherContract.ProjectISBN = OtherContract.ProjectISBN; _OtherContract.Contracttypeid = OtherContract.Contracttypeid; // _OtherContract.ContractDate = OtherContract.ContractDate; // _OtherContract.Periodofagreement = OtherContract.Periodofagreement; // _OtherContract.Expirydate = OtherContract.Expirydate; _OtherContract.Territoryrightsid = OtherContract.Territoryrightsid; _OtherContract.Payment = OtherContract.Payment; _OtherContract.paymentperiodid = OtherContract.paymentperiodid; _OtherContract.NatureOfWork = OtherContract.NatureOfWork; // _OtherContract.divisionid = OtherContract.divisionid; _OtherContract.ContractSignedByExecutiveid = OtherContract.ContractSignedByExecutiveid; _OtherContract.Remarks = OtherContract.Remarks; _OtherContract.EnteredBy = OtherContract.EnteredBy; _OtherContract.PaymentAmount = OtherContract.PaymentAmount; _OtherContract.CurrencyMasterId = OtherContract.CurrencyMasterId; OtherContractIdId = _OtherContractService.InsertOtherContract(_OtherContract); if (OtherContractIdId != 0) { OtherContractDivisionLink DivisionLink = new OtherContractDivisionLink(); int k = 0; foreach (var item in OtherContract.Division) { DivisionLink.othercontractid = OtherContractIdId; DivisionLink.divisionid = item; DivisionLink.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDivisionLink(DivisionLink); k++; } OtherContractDocuments _OtherContractDoc = new OtherContractDocuments(); string[] docurl = OtherContract.documentfile.Split(','); int i = 0; foreach (string doc in OtherContract.Documentname) { OtherContractDocuments Link = new OtherContractDocuments(); Link.othercontractid = OtherContractIdId; Link.Documentname = doc; Link.documentfile = docurl[i]; Link.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDocumentsLinking(Link); i++; } if (OtherContract.ForImageBank == "1") { /* Added by dheeraj Kumar sharma */ OtherContractImageBank _OtherContractImageBank = new OtherContractImageBank(); IList <VideoImageBank> ImageBankList = new List <VideoImageBank>(); if (OtherContract.VideoImageBank.Count > 0) { foreach (var obj in OtherContract.VideoImageBank) { VideoImageBank obj_VideoImageBank = new VideoImageBank(); obj_VideoImageBank.Type = obj.Type; obj_VideoImageBank.ShortName = obj.ShortName; obj_VideoImageBank.Fullname = obj.Fullname; obj_VideoImageBank.CurrencyId = obj.CurrencyId; obj_VideoImageBank.Cost = obj.Cost; obj_VideoImageBank.Deactivate = "N"; obj_VideoImageBank.EnteredBy = OtherContract.EnteredBy; obj_VideoImageBank.EntryDate = DateTime.Now; ImageBankList.Add(obj_VideoImageBank); } } _OtherContractImageBank.VideoImageBank = ImageBankList; /*End by dheeraj*/ _OtherContractImageBank.Printrunquantity = OtherContract.Printrunquantity; _OtherContractImageBank.PrintRights = OtherContract.PrintRights; _OtherContractImageBank.electronicrights = OtherContract.electronicrights; _OtherContractImageBank.ebookrights = OtherContract.ebookrights; _OtherContractImageBank.cost = OtherContract.cost; _OtherContractImageBank.currencyid = OtherContract.currencyid; _OtherContractImageBank.restriction = OtherContract.restriction; _OtherContractImageBank.othercontractid = OtherContractIdId; _OtherContractImageBank.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractImageBank(_OtherContractImageBank); } } OtherContractLink _OtherContractLink1 = new OtherContractLink(); _OtherContractLink1.Contractstatus = null; _OtherContractLink1.SignedContractSentDate = null; _OtherContractLink1.SignedContractReceived_Date = null; _OtherContractLink1.CancellationDate = null; _OtherContractLink1.Cancellation_Reason = null; _OtherContractLink1.othercontractid = OtherContractIdId; _OtherContractLink1.Status = "Pending"; _OtherContractLink1.EnteredBy = OtherContract.EnteredBy; _OtherContractLink1.Remarks = OtherContract.PendingRemarks; int OtherContractLinkIdId = _OtherContractService.InsertOtherContractLink(_OtherContractLink1); ApplicationSetUp Mobj_ApplicationSetUp = new ApplicationSetUp(); Mobj_ApplicationSetUp.Id = OtherContractSuggesation.FirstOrDefault().Id; ApplicationSetUp _ApplicationSetUpUpdate = _ApplicationSetUpService.GetApplicationSetUpById(Mobj_ApplicationSetUp); _ApplicationSetUpUpdate.Id = OtherContractSuggesation.FirstOrDefault().Id; int Value = Int32.Parse(OtherContractSuggesation.FirstOrDefault().OtherContractValue) + 1; _ApplicationSetUpUpdate.keyValue = Value.ToString().PadLeft(4, '0'); _ApplicationSetUpUpdate.ModifiedBy = OtherContract.EnteredBy; _ApplicationSetUpUpdate.ModifiedDate = DateTime.Now; _ApplicationSetUpService.UpdateApplication(_ApplicationSetUpUpdate); } else { if (OtherContract.UpdateRight == "rt" || OtherContract.UpdateRight == "fc") { OtherContractLink mobj_OtherContractLink = _OtherContractLink.Table.Where(i => i.othercontractid == OtherContract.Id && i.Deactivate == "N").FirstOrDefault(); if (mobj_OtherContractLink != null) { mobj_OtherContractLink.Contractstatus = OtherContract.Contractstatus; mobj_OtherContractLink.SignedContractSentDate = OtherContract.SignedContractSentDate; mobj_OtherContractLink.SignedContractReceived_Date = OtherContract.SignedContractReceived_Date; mobj_OtherContractLink.CancellationDate = OtherContract.CancellationDate; mobj_OtherContractLink.Cancellation_Reason = OtherContract.Cancellation_Reason; mobj_OtherContractLink.othercontractid = OtherContract.Id; mobj_OtherContractLink.ModifiedBy = OtherContract.EnteredBy; mobj_OtherContractLink.Status = OtherContract.Contractstatus; mobj_OtherContractLink.Remarks = OtherContract.PendingRemarks; mobj_OtherContractLink.AgreementDate = OtherContract.AgreementDate; mobj_OtherContractLink.Effectivedate = OtherContract.Effectivedate; //mobj_OtherContractLink.Contractperiodinmonth = OtherContract.Contractperiodinmonth; mobj_OtherContractLink.Expirydate = OtherContract.Expirydate; _OtherContractService.UpdateOtherContractLink(mobj_OtherContractLink); OtherContractLinkDocument _OtherContractDocLink = new OtherContractLinkDocument(); string[] docurl1 = OtherContract.documentfileLink.Split(','); int i = 0; foreach (string doc in OtherContract.DocumentnameLink) { OtherContractLinkDocument Link = new OtherContractLinkDocument(); Link.othercontractLinkid = mobj_OtherContractLink.Id; Link.DocumentnameLink = doc; Link.documentfileLink = docurl1[i]; Link.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDocumentsLinkingLink(Link); i++; } } } else if (OtherContract.UpdateRight == "ad" || OtherContract.UpdateRight == "sa") { OtherContractMaster mobj_OtherDocument = _OtherContractService.GetOtherContractMasterId(OtherContract.Id); mobj_OtherDocument.partyname = OtherContract.partyname; mobj_OtherDocument.natureofserviceid = OtherContract.natureofserviceid; mobj_OtherDocument.natureofsubserviceid = OtherContract.natureofsubserviceid; mobj_OtherDocument.Address = OtherContract.Address; mobj_OtherDocument.CountryId = OtherContract.CountryId; mobj_OtherDocument.OtherCountry = OtherContract.OtherCountry; mobj_OtherDocument.Stateid = OtherContract.Stateid; mobj_OtherDocument.OtherState = OtherContract.OtherState; mobj_OtherDocument.Cityid = OtherContract.Cityid; mobj_OtherDocument.OtherCity = OtherContract.OtherCity; mobj_OtherDocument.Pincode = OtherContract.Pincode; mobj_OtherDocument.Mobile = OtherContract.Mobile; mobj_OtherDocument.Email = OtherContract.Email; mobj_OtherDocument.PANNo = OtherContract.PANNo; mobj_OtherDocument.Requestdate = OtherContract.Requestdate; mobj_OtherDocument.ProjectTitle = OtherContract.ProjectTitle; mobj_OtherDocument.ProjectISBN = OtherContract.ProjectISBN; mobj_OtherDocument.Contracttypeid = OtherContract.Contracttypeid; // mobj_OtherDocument.ContractDate = OtherContract.ContractDate; // mobj_OtherDocument.Periodofagreement = OtherContract.Periodofagreement; // mobj_OtherDocument.Expirydate = OtherContract.Expirydate; mobj_OtherDocument.Territoryrightsid = OtherContract.Territoryrightsid; mobj_OtherDocument.Payment = OtherContract.Payment; mobj_OtherDocument.paymentperiodid = OtherContract.paymentperiodid; mobj_OtherDocument.NatureOfWork = OtherContract.NatureOfWork; // mobj_OtherDocument.divisionid = OtherContract.divisionid; mobj_OtherDocument.ContractSignedByExecutiveid = OtherContract.ContractSignedByExecutiveid; mobj_OtherDocument.Remarks = OtherContract.Remarks; mobj_OtherDocument.ModifiedBy = OtherContract.EnteredBy; mobj_OtherDocument.PaymentAmount = OtherContract.PaymentAmount; mobj_OtherDocument.CurrencyMasterId = OtherContract.CurrencyMasterId; _OtherContractService.UpdateOtherContractMaster(mobj_OtherDocument); _OtherContractService.DeleteOtherContractDivisionLink(OtherContract.Id, OtherContract.EnteredBy); OtherContractDivisionLink DivisionLink = new OtherContractDivisionLink(); int k = 0; foreach (var item in OtherContract.Division) { DivisionLink.othercontractid = OtherContract.Id; DivisionLink.divisionid = item; DivisionLink.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDivisionLink(DivisionLink); k++; } OtherContractImageBank mobj_OtherContractImageBank = _OtherContractImageBank.Table.Where(i => i.othercontractid == OtherContract.Id && i.Deactivate == "N").FirstOrDefault(); if (mobj_OtherContractImageBank != null) { _OtherContractService.DeleteVideoImageBankLink(mobj_OtherContractImageBank.Id, OtherContract.EnteredBy); if (OtherContract.VideoImageBank.Count > 0) { int m = 0; foreach (var obj in OtherContract.VideoImageBank) { VideoImageBank obj_VideoImageBank = new VideoImageBank(); obj_VideoImageBank.Type = obj.Type; obj_VideoImageBank.ShortName = obj.ShortName; obj_VideoImageBank.Fullname = obj.Fullname; obj_VideoImageBank.CurrencyId = obj.CurrencyId; obj_VideoImageBank.Cost = obj.Cost; obj_VideoImageBank.ImageBankId = mobj_OtherContractImageBank.Id; obj_VideoImageBank.EnteredBy = OtherContract.EnteredBy; obj_VideoImageBank.EntryDate = DateTime.Now; obj_VideoImageBank.Deactivate = "N"; _OtherContractService.InsertVideoImageBankLink(obj_VideoImageBank); m++; } } mobj_OtherContractImageBank.Printrunquantity = OtherContract.Printrunquantity; mobj_OtherContractImageBank.PrintRights = OtherContract.PrintRights; mobj_OtherContractImageBank.electronicrights = OtherContract.electronicrights; mobj_OtherContractImageBank.ebookrights = OtherContract.ebookrights; mobj_OtherContractImageBank.cost = OtherContract.cost; mobj_OtherContractImageBank.currencyid = OtherContract.currencyid; mobj_OtherContractImageBank.restriction = OtherContract.restriction; mobj_OtherContractImageBank.othercontractid = OtherContract.Id; mobj_OtherContractImageBank.ModifiedBy = OtherContract.EnteredBy; _OtherContractService.UpdateOtherContractImageBank(mobj_OtherContractImageBank); } else if (OtherContract.ForImageBank == "1") { //OtherContractImageBank _OtherConImageBank = new OtherContractImageBank(); //_OtherConImageBank.Printrunquantity = OtherContract.Printrunquantity; //_OtherConImageBank.PrintRights = OtherContract.PrintRights; //_OtherConImageBank.electronicrights = OtherContract.electronicrights; //_OtherConImageBank.ebookrights = OtherContract.ebookrights; //_OtherConImageBank.cost = OtherContract.cost; //_OtherConImageBank.currencyid = OtherContract.currencyid; //_OtherConImageBank.restriction = OtherContract.restriction; //_OtherConImageBank.othercontractid = OtherContract.Id; //_OtherConImageBank.EnteredBy = OtherContract.EnteredBy; //_OtherContractService.InsertOtherContractImageBank(_OtherConImageBank); OtherContractImageBank _OtherConImageBank = new OtherContractImageBank(); IList <VideoImageBank> ImageBankList = new List <VideoImageBank>(); if (OtherContract.VideoImageBank.Count > 0) { foreach (var obj in OtherContract.VideoImageBank) { VideoImageBank obj_VideoImageBank = new VideoImageBank(); obj_VideoImageBank.Type = obj.Type; obj_VideoImageBank.ShortName = obj.ShortName; obj_VideoImageBank.Fullname = obj.Fullname; obj_VideoImageBank.CurrencyId = obj.CurrencyId; obj_VideoImageBank.Cost = obj.Cost; obj_VideoImageBank.Deactivate = "N"; obj_VideoImageBank.EnteredBy = OtherContract.EnteredBy; obj_VideoImageBank.EntryDate = DateTime.Now; ImageBankList.Add(obj_VideoImageBank); } } _OtherConImageBank.VideoImageBank = ImageBankList; /*End by dheeraj*/ _OtherConImageBank.Printrunquantity = OtherContract.Printrunquantity; _OtherConImageBank.PrintRights = OtherContract.PrintRights; _OtherConImageBank.electronicrights = OtherContract.electronicrights; _OtherConImageBank.ebookrights = OtherContract.ebookrights; _OtherConImageBank.cost = OtherContract.cost; _OtherConImageBank.currencyid = OtherContract.currencyid; _OtherConImageBank.restriction = OtherContract.restriction; _OtherConImageBank.othercontractid = OtherContract.Id; _OtherConImageBank.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractImageBank(_OtherConImageBank); } OtherContractDocuments _OtherContractDoc = new OtherContractDocuments(); string[] docurl = OtherContract.documentfile.Split(','); int j = 0; foreach (string doc in OtherContract.Documentname) { OtherContractDocuments Link = new OtherContractDocuments(); Link.othercontractid = OtherContract.Id; Link.Documentname = doc; Link.documentfile = docurl[j]; Link.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDocumentsLinking(Link); j++; } OtherContractLink mobj_OtherContractLink = _OtherContractLink.Table.Where(i => i.othercontractid == OtherContract.Id && i.Deactivate == "N").FirstOrDefault(); if (mobj_OtherContractLink != null) { mobj_OtherContractLink.Contractstatus = OtherContract.Contractstatus; mobj_OtherContractLink.SignedContractSentDate = OtherContract.SignedContractSentDate; mobj_OtherContractLink.SignedContractReceived_Date = OtherContract.SignedContractReceived_Date; mobj_OtherContractLink.CancellationDate = OtherContract.CancellationDate; mobj_OtherContractLink.Cancellation_Reason = OtherContract.Cancellation_Reason; mobj_OtherContractLink.othercontractid = OtherContract.Id; mobj_OtherContractLink.ModifiedBy = OtherContract.EnteredBy; mobj_OtherContractLink.Status = OtherContract.Contractstatus; mobj_OtherContractLink.Remarks = OtherContract.PendingRemarks; mobj_OtherContractLink.AgreementDate = OtherContract.AgreementDate; mobj_OtherContractLink.Effectivedate = OtherContract.Effectivedate; //mobj_OtherContractLink.Contractperiodinmonth = OtherContract.Contractperiodinmonth; mobj_OtherContractLink.Expirydate = OtherContract.Expirydate; _OtherContractService.UpdateOtherContractLink(mobj_OtherContractLink); OtherContractLinkDocument _OtherContractDocLink = new OtherContractLinkDocument(); string[] docurl1 = OtherContract.documentfileLink.Split(','); int i = 0; foreach (string doc in OtherContract.DocumentnameLink) { OtherContractLinkDocument Link = new OtherContractLinkDocument(); Link.othercontractLinkid = mobj_OtherContractLink.Id; Link.DocumentnameLink = doc; Link.documentfileLink = docurl1[i]; Link.EnteredBy = OtherContract.EnteredBy; _OtherContractService.InsertOtherContractDocumentsLinkingLink(Link); i++; } } } //------------------------------------------- OtherContractIdId = OtherContract.Id; OtherContactCode = _OtherContractMaster.Table.Where(a => a.Id == OtherContract.Id).Select(b => b.othercontractcode).SingleOrDefault(); } status = _localizationService.GetResource("Master.API.Success.Message"); } catch (ACSException ex) { status = ex.ToString(); } catch (Exception ex) { status = ex.ToString(); } return(Json(SerializeObj.SerializeObject(new { status, OtherContactCode, OtherContractIdId }))); }