예제 #1
0
        public static int EnquiryFollowUpModel(EnquiryFollowUpModel model)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    EnquiryFollowUp ef = new EnquiryFollowUp();
                    //var temp1 = context.EnquiryFollowUps.Find(model.InquiryId);
                    // ef = temp1 == null ? new EnquiryFollowUp() : temp1;

                    ef.EnquiryId       = model.InquiryId;
                    ef.EnquiryStatus   = model.InquiryStatus;
                    ef.Remarks         = model.Remarks;
                    ef.NextFolowupDate = model.NextFolowupDate;
                    context.EnquiryFollowUps.Add(ef);
                    context.SaveChanges();
                }
                return(1);
            }
            catch (Exception)
            {
                return(0);
            }
        }
예제 #2
0
        public static bool AddEnquiry(EnquiryModel model)
        {
            try
            {
                using (HJStudioEntities context = new HJStudioEntities())
                {
                    ClientMaster clt  = new ClientMaster();
                    var          temp = context.ClientMasters.Find(model.client.ClientID);
                    clt = temp == null ? new ClientMaster() : temp;

                    clt.Name     = model.client.Name;
                    clt.MobileNo = model.client.MobileNo;
                    clt.EmailId  = model.client.EmailId;
                    clt.Address1 = model.client.Address1;
                    clt.Address2 = model.client.Address2;
                    clt.City     = model.client.City;
                    clt.State    = model.client.State;
                    clt.Refrence = model.client.Refrence;



                    if (temp == null)
                    {
                        clt.CreatedBy   = "Admin";
                        clt.CreatedDate = DateTime.Now;
                        context.ClientMasters.Add(clt);
                    }
                    else
                    {
                        clt.ModifiedBy   = "Admin";
                        clt.ModifiedDate = DateTime.Now;
                    }
                    context.SaveChanges();
                    if (temp == null)
                    {
                        model.client.ClientID = clt.ClientID;
                    }


                    FunctionDetail flt   = new FunctionDetail();
                    var            temp1 = context.FunctionDetails.Find(model.Id);
                    flt = temp1 == null ? new FunctionDetail() : temp1;

                    flt.FunctionName        = model.FunctionName;
                    flt.FunctionDescription = model.FunctionDescription;
                    flt.FunctionDate        = model.FunctionDate;
                    flt.City     = model.City;
                    flt.State    = model.State;
                    flt.Address  = model.Address;
                    flt.ClientId = model.client.ClientID;

                    if (temp1 == null)
                    {
                        flt.CreatedDate = DateTime.Now;
                        flt.CreatedBy   = "Admin";
                        context.FunctionDetails.Add(flt);
                    }
                    else
                    {
                        flt.ModifiedDate = DateTime.Now;
                        flt.ModifiedBy   = "Admin";
                    }

                    EnquiryFollowUp EF = new EnquiryFollowUp();
                    EF.NextFolowupDate = model.FunctionDate;
                    EF.EnquiryId       = flt.Id;
                    EF.CreatedDate     = DateTime.Now;
                    EF.CreatedBy       = "Admin";
                    EF.EnquiryStatus   = 2;
                    context.SaveChanges();

                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }