Esempio n. 1
0
        // PUT api/LeadRecord/5
        public IHttpActionResult PutLeadRecord(string id, LeadRecord leadrecord)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != leadrecord.LeadRecordId)
            {
                return(BadRequest());
            }

            db.Entry(leadrecord).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LeadRecordExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
        public IHttpActionResult PostLeadRecord(LeadRecord leadrecord)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LeadRecords.Add(leadrecord);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (LeadRecordExists(leadrecord.LeadRecordId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = leadrecord.LeadRecordId }, leadrecord));
        }
Esempio n. 3
0
        public IHttpActionResult GetLeadRecordByColumn(string columnName, string columnValue)
        {
            LeadRecord leadrecord = null;

            if (columnName.ToUpper().Equals("LEADRECORDID"))
            {
                leadrecord = db.LeadRecords.Find(columnValue);
            }
            else
            {
                if (columnName.Equals("Phone"))
                {
                    leadrecord = db.LeadRecords.Where(x => x.Phone == columnValue).FirstOrDefault();
                }

                if (columnName.Equals("CustomId"))
                {
                    leadrecord = db.LeadRecords.Where(x => x.CustomId == columnValue).FirstOrDefault();
                }

                //var query = from res in db.LeadRecords.AsEnumerable()
                //            where res.Field<string>(columnName).Contains(columnValue)
                //            select res;
            }

            if (leadrecord == null)
            {
                return(NotFound());
            }

            return(Ok(leadrecord));
        }
        public virtual JsonResult Create([DataSourceRequest] DataSourceRequest request, ContactTaskViewModel task)
        {
            if (ModelState.IsValid)
            {
                task.TaskType     = "VIRTUAL TOUR";
                task.ContactId    = SessionControl.SessionManager.GetContactId(Session);
                task.ClientID     = SessionControl.SessionManager.GetClientId(HttpContext.Session);
                task.LeadID       = SessionControl.SessionManager.GetProgramParameterByKey("LeadID", HttpContext.Session);
                task.CreatedDate  = DateTime.Now;
                task.ModifiedDate = DateTime.Now;

                string EndTimeMinute = SessionControl.SessionManager.GetScriptParameterByKey("EndTimeMinute", HttpContext.Session);

                if (!string.IsNullOrEmpty(EndTimeMinute))
                {
                    task.End = task.Start.AddMinutes(Convert.ToDouble(EndTimeMinute));
                }

                if (taskService.IsExist(task.UserID, task.ClientID, task.Start, task.End))
                {
                    ModelState.AddModelError("errors", "This user is not available in this time period.");
                }
                else
                {
                    taskService.Insert(task, ModelState);

                    LeadRecord lead = taskService.GetLead(SessionControl.SessionManager.GetProgramParameterByKey("LeadID", HttpContext.Session));
                    lead.LeadOwner    = task.UserID;
                    lead.ModifiedDate = DateTime.Now;
                    taskService.UpdateLead(lead);
                }
            }

            return(Json(new[] { task }.ToDataSourceResult(request, ModelState)));
        }
Esempio n. 5
0
        public IHttpActionResult GetLeadRecord(string id)
        {
            LeadRecord leadrecord = db.LeadRecords.Find(id);

            if (leadrecord == null)
            {
                return(NotFound());
            }

            return(Ok(leadrecord));
        }
 public virtual void UpdateLead(LeadRecord leadRecord)
 {
     try
     {
         db.Entry(leadRecord).State = EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 7
0
        public IHttpActionResult DeleteLeadRecord(int id)
        {
            LeadRecord leadrecord = db.LeadRecords.Find(id);

            if (leadrecord == null)
            {
                return(NotFound());
            }

            db.LeadRecords.Remove(leadrecord);
            db.SaveChanges();

            return(Ok(leadrecord));
        }
        public DataObjects GetDataObjectCRMLead(int objectID, LeadRecord LeadRec)
        {
            ScriptObject Dob = GetDataObjectbyID(objectID);

            DataObjects DO = new DataObjects();

            DO.DOID   = Dob.ScriptObjectID;
            DO.DOName = Dob.ObjectName;

            List <DataObjects> theObs = new List <DataObjects>();
            Int32 thecount            = 0;

            Type objtype = LeadRec.GetType();

            PropertyInfo[] FIS = objtype.GetProperties();
            string         stringval;

            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            foreach (PropertyInfo fi in FIS)
            {
                switch (fi.PropertyType.Name)
                {
                case "String":
                    stringval = (string)objtype.InvokeMember(fi.Name, BindingFlags.GetProperty, null, LeadRec, null);
                    dictionary.Add(fi.Name, stringval);

                    break;

                case "DateTime":
                    DateTime datetimecol = (DateTime)objtype.InvokeMember(fi.Name, BindingFlags.GetProperty, null, LeadRec, null);
                    stringval = datetimecol.ToString();
                    dictionary.Add(fi.Name, stringval);

                    break;
                }
            }
            foreach (LeadRecordAttribute LRA in LeadRec.LeadRecordAttributes)
            {
                dictionary.Add(LRA.LeadAttributeName, LRA.LeadAttributeValue);
            }

            DO.Details = FillDetails(Dob.ScriptObjectID);
            DO.DictionaryMatch(dictionary);

            return(DO);
        }
Esempio n. 9
0
        protected void generateLead()
        {
            if (DropDownList_Level1.SelectedValue.Equals("_"))
            {
                Label_Status.Text      = "Please select one product category";
                Label_Status.ForeColor = System.Drawing.Color.Red;
                Label_Status.Visible   = true;

                Button_Submit_Next0.Enabled         = true;
                Button_Submit_Next.Enabled          = true;
                Button_Submit_Extra_Prd_Srv.Enabled = true;
            }
            else
            {
                BackEndObjects.RFQDetails rfqObj = new BackEndObjects.RFQDetails();
                BackEndObjects.Id         idGen  = new BackEndObjects.Id();
                String rfqId = "";
                if (Session[SessionFactory.CREATE_LEAD_RFQ_ID] == null)
                {
                    rfqId = idGen.getNewId(BackEndObjects.Id.ID_TYPE_RFQ_STRING);
                    Session[SessionFactory.CREATE_LEAD_RFQ_ID] = rfqId; //store the newly created RFQ id in the session
                }
                if (!TextBox_Spec.Text.Equals(""))
                {
                    getAddintionalProdSrvList();
                    TextBox_Spec.Text = "";
                }

                ArrayList rfqSpecObjList = (ArrayList)Session[SessionFactory.CREATE_LEAD_SELECTED_RFQ_SPEC_MAP];

                //Set the RFQ id for all the  spec objects
                if (rfqSpecObjList != null)
                {
                    for (int i = 0; i < rfqSpecObjList.Count; i++)
                    {
                        ((BackEndObjects.RFQProductServiceDetails)rfqSpecObjList[i]).setRFQId(rfqId);
                    }
                }

                rfqObj.setRFQProdServList(rfqSpecObjList);
                rfqObj.setRFQId(rfqId);
                rfqObj.setCreatedUsr(User.Identity.Name);
                rfqObj.setActiveStat(BackEndObjects.RFQDetails.RFQ_ACTIVE_STAT_ACTIVE);
                rfqObj.setDueDate(TextBox_Within_Date.Text);
                //For Manually Created Lead entity id and CreateEntityId is different for the same rfq/lead object
                rfqObj.setEntityId(DropDownList_Contacts.SelectedValue);
                rfqObj.setCreatedEntity(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

                //     FileUpload1=(FileUpload1 == null ? (FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE] : FileUpload1);
                String localId = (!DropDownList_Locality.SelectedValue.Equals("_") && !DropDownList_Locality.SelectedValue.Equals("") ?
                                  DropDownList_Locality.SelectedValue : (!DropDownList_City.SelectedValue.Equals("_") && !DropDownList_City.SelectedValue.Equals("") ?
                                                                         DropDownList_City.SelectedValue : (!DropDownList_State.SelectedValue.Equals("_") && !DropDownList_State.SelectedValue.Equals("") ?
                                                                                                            DropDownList_State.SelectedValue : (!DropDownList_Country.SelectedValue.Equals("_") && !DropDownList_Country.SelectedValue.Equals("") ?
                                                                                                                                                DropDownList_Country.SelectedValue:""))));

                rfqObj.setLocalityId(localId);
                rfqObj.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                rfqObj.setTermsandConds(TextBox_TnC.Text);
                rfqObj.setRFQName(TextBox_Reqr_Name.Text);
                rfqObj.setCreateMode(RFQDetails.CREATION_MODE_MANUAL);
                rfqObj.setCurrency(DropDownList_Curr.SelectedValue);

                BackEndObjects.RFQProdServQnty rfqPrdQnty = new BackEndObjects.RFQProdServQnty();
                rfqPrdQnty.setRFQId(rfqObj.getRFQId());
                rfqPrdQnty.setFromPrice(TextBox_Price_Range_From.Text);
                rfqPrdQnty.setToPrice(TextBox_Price_Range_To.Text);
                rfqPrdQnty.setFromQnty(float.Parse(TextBox_Prod_Qnty_From.Text));
                rfqPrdQnty.setToQnty(float.Parse(TextBoxrod_Qnty_To.Text));
                rfqPrdQnty.setMsrmntUnit(DropDownList_Unit_Of_Msrmnt.SelectedValue);
                rfqPrdQnty.setProdCatId(Session[SessionFactory.CREATE_LEAD_SELECTED_PRODUCT_CAT].ToString());
                //ArrayList rfqPrdQntyList = new ArrayList();
                //rfqPrdQntyList.Add(rfqPrdQnty);

                ArrayList prodSrvQntyList = (ArrayList)Session[SessionFactory.CREATE_LEAD_PROD_SRV_QNTY_LIST];

                if (prodSrvQntyList == null)
                {
                    prodSrvQntyList = new ArrayList();
                }

                prodSrvQntyList.Add(rfqPrdQnty);

                //Ensure that all objects in the arraylist has an associated rfqid
                for (int i = 0; i < prodSrvQntyList.Count; i++)
                {
                    BackEndObjects.RFQProdServQnty temp = (RFQProdServQnty)prodSrvQntyList[i];
                    if (temp.getRFQId() == null || temp.getRFQId().Equals(""))
                    {
                        temp.setRFQId(rfqObj.getRFQId());
                    }
                }

                rfqObj.setRFQProdServQntyList(prodSrvQntyList);

                Dictionary <String, String> reqSpecUniqnessValidation = new Dictionary <string, string>();

                if (rfqSpecObjList != null)
                {
                    for (int i = 0; i < rfqSpecObjList.Count; i++)
                    {
                        BackEndObjects.RFQProductServiceDetails rfqSpecObj = (BackEndObjects.RFQProductServiceDetails)rfqSpecObjList[i];
                        if (reqSpecUniqnessValidation.ContainsKey(rfqSpecObj.getPrdCatId() + ":" + rfqSpecObj.getFeatId()))
                        {
                            rfqSpecObjList.RemoveAt(i);//Remove the current RFQ spec object from the list - otherwise it will cause exception at DB layer while inserting
                        }
                        else
                        {
                            reqSpecUniqnessValidation.Add(rfqSpecObj.getPrdCatId() + ":" + rfqSpecObj.getFeatId(), "");
                            if (rfqSpecObj.getFileStream() != null)
                            {
                                rfqSpecObj.setImgPathInFileStore(rfqObj.getEntityId());
                            }
                        }
                    }
                }

                BackEndObjects.RFQResponse leadRespObj = new RFQResponse();
                leadRespObj.setRespEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                leadRespObj.setRFQId(Session[SessionFactory.CREATE_LEAD_RFQ_ID].ToString());
                leadRespObj.setRespDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                leadRespObj.setNextFollowupDate(TextBox_Fwp_Date.Text);
                leadRespObj.setAssignedTo(DropDownList_Users.SelectedValue);
                //Load the document for the lead response
                if (FileUpload1 != null && FileUpload1.HasFile)
                {
                    leadRespObj.setFileStream(FileUpload1);
                    leadRespObj.setNDADocPathInFileStore(leadRespObj.getRespEntityId());
                }
                else if ((FileUpload)Session[SessionFactory.CREATE_LEAD_NDA_FILE] != null && ((FileUpload)Session[SessionFactory.CREATE_LEAD_NDA_FILE]).HasFile)
                {
                    leadRespObj.setFileStream((FileUpload)Session[SessionFactory.CREATE_LEAD_NDA_FILE]);
                    leadRespObj.setNDADocPathInFileStore(leadRespObj.getRespEntityId());
                }

                ArrayList leadRespQuoteList = (ArrayList)Session[SessionFactory.CREATE_LEAD_RESP_QUOTE_LIST];
                if (leadRespQuoteList == null)
                {
                    leadRespQuoteList = new ArrayList();
                }

                BackEndObjects.RFQResponseQuotes respQuoteObj = new RFQResponseQuotes();
                respQuoteObj.setPrdCatId(Session[SessionFactory.CREATE_LEAD_SELECTED_PRODUCT_CAT].ToString());
                respQuoteObj.setQuote((TextBox_Quote_Amnt.Text.Equals("") ? "0" : TextBox_Quote_Amnt.Text));
                respQuoteObj.setResponseEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
                respQuoteObj.setResponseUsrId(User.Identity.Name);
                //respQuoteObj.setUnitName(Session[SessionFactory.CREATE_LEAD_QUOTE_UNIT].ToString());
                respQuoteObj.setUnitName(Label_Per_Unit.Text);
                respQuoteObj.setProductName((!TextBox_Prod_Name.Text.Equals("") ? TextBox_Prod_Name.Text.Trim() : DropDownList_Prod_List.SelectedItem.Text));

                leadRespQuoteList.Add(respQuoteObj);
                //Ensure that all objects in the arraylist has an associated rfqid
                for (int i = 0; i < leadRespQuoteList.Count; i++)
                {
                    BackEndObjects.RFQResponseQuotes temp = (RFQResponseQuotes)leadRespQuoteList[i];
                    if (temp.getRFQId() == null || temp.getRFQId().Equals(""))
                    {
                        temp.setRFQId(rfqObj.getRFQId());
                    }
                }

                leadRespObj.setResponseQuoteList(leadRespQuoteList);

                ActionLibrary.SalesActions._createLeads cL = new ActionLibrary.SalesActions._createLeads();

                LeadRecord leadObj = new LeadRecord();
                leadObj.setRFQProdServList(rfqObj.getRFQProdServList());
                leadObj.setRFQId(rfqObj.getRFQId());
                leadObj.setActiveStat(rfqObj.getActiveStat());
                leadObj.setApprovalStat(rfqObj.getApprovalStat());
                leadObj.setCreatedEntity(rfqObj.getCreatedEntity());
                leadObj.setCreatedUsr(rfqObj.getCreatedUsr());
                leadObj.setCreateMode(rfqObj.getCreateMode());
                leadObj.setDueDate(rfqObj.getDueDate());
                leadObj.setEntityId(rfqObj.getEntityId());
                leadObj.setFileStream(rfqObj.getFileStream());
                leadObj.setLocalityId(rfqObj.getLocalityId());
                leadObj.setNDADocPath(rfqObj.getNDADocPath());
                leadObj.setReqId(rfqObj.getReqId());
                leadObj.setRFQName(rfqObj.getRFQName());
                leadObj.setRFQProdServQntyList(rfqObj.getRFQProdServQntyList());
                leadObj.setSubmitDate(rfqObj.getSubmitDate());
                leadObj.setTermsandConds(rfqObj.getTermsandConds());
                leadObj.setCurrency(rfqObj.getCurrency());

                leadObj.setLeadResp(leadRespObj);


                try
                {
                    cL.createNewLead(leadObj, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), User.Identity.Name);
                    Label_Status.Text      = "Lead created successfully";
                    Label_Status.ForeColor = System.Drawing.Color.Green;
                    Label_Status.Visible   = true;

                    DataTable dt = (DataTable)Session[SessionFactory.ALL_SALE_ALL_LEAD_GRID_DATA];
                    Dictionary <String, Currency> allCurrList = (Dictionary <String, Currency>)Session[SessionFactory.CURRENCY_LIST];
                    //DateUtility dU = new DateUtility();

                    dt.Rows.Add();
                    int count = dt.Rows.Count - 1;


                    dt.Rows[count]["RFQNo"]   = leadObj.getRFQId();
                    dt.Rows[count]["RFQName"] = leadObj.getRFQName();

                    String alertRequired = "true";
                    for (int j = 0; j < leadRespQuoteList.Count; j++)
                    {
                        RFQResponseQuotes QuoteObj = (RFQResponseQuotes)leadRespQuoteList[j];
                        if (!QuoteObj.getQuote().Equals("0"))
                        {
                            alertRequired = "false"; break;
                        }
                    }

                    DateUtility dU = new DateUtility();

                    dt.Rows[count]["Lead_Alert_Required"] = alertRequired;
                    dt.Rows[count]["CustName"]            = DropDownList_Contacts.SelectedItem.Text;
                    dt.Rows[count]["CustId"] = leadObj.getEntityId();
                    dt.Rows[count]["curr"]   = allCurrList.ContainsKey(leadObj.getCurrency()) ?
                                               allCurrList[leadObj.getCurrency()].getCurrencyName() : "";
                    dt.Rows[count]["Submit Date"]       = leadObj.getSubmitDate();
                    dt.Rows[count]["Submit Date Ticks"] = Convert.ToDateTime(leadObj.getSubmitDate()).Ticks;
                    dt.Rows[count]["Due Date"]          = dU.getConvertedDateWoTime(leadObj.getDueDate());
                    dt.Rows[count]["Due Date Ticks"]    = !dt.Rows[count]["Due Date"].Equals("") ? Convert.ToDateTime(leadObj.getDueDate()).Ticks : 0;
                    dt.Rows[count]["Next Date"]         = dU.getConvertedDateWoTime(TextBox_Fwp_Date.Text.Trim());
                    dt.Rows[count]["Next Date Ticks"]   = (!dt.Rows[count]["Next Date"].Equals("") ? Convert.ToDateTime(TextBox_Fwp_Date.Text).Ticks : 0);
                    dt.Rows[count]["Assgn To"]          = (!DropDownList_Users.SelectedValue.Equals("") ? DropDownList_Users.SelectedValue : "");
                    dt.Rows[count]["ActiveStat"]        = leadObj.getActiveStat();
                    dt.Rows[count]["Mode"] = leadObj.getCreateMode();

                    dt.DefaultView.Sort = "Submit Date Ticks" + " " + "DESC";
                    Session[SessionFactory.ALL_SALE_ALL_LEAD_GRID_DATA] = dt.DefaultView.ToTable();



                    ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshLeadGrid", "RefreshParent();", true);
                }
                catch (Exception ex)
                {
                    Label_Status.Text      = "Lead creation failed";
                    Label_Status.ForeColor = System.Drawing.Color.Red;
                    Label_Status.Visible   = true;
                }
                finally
                {
                    Session.Remove(SessionFactory.CREATE_LEAD_SELECTED_RFQ_SPEC_MAP);
                    Session.Remove(SessionFactory.CREATE_LEAD_RFQ_ID);
                    Session.Remove(SessionFactory.CREATE_LEAD_PROD_SRV_QNTY_LIST);
                    Session.Remove(SessionFactory.CREATE_LEAD_NDA_FILE);
                    Session.Remove(SessionFactory.CREATE_LEAD_RESP_QUOTE_LIST);
                    Session.Remove(SessionFactory.CREATE_LEAD_QUOTE_UNIT);
                }
            }
        }
 public IHttpActionResult GetDataObjectCRM(int objectid, LeadRecord LR)
 {
     return(Ok(GetDataObjectCRMLead(objectid, LR)));
 }
Esempio n. 11
0
        /// <summary>
        /// if create potential is true then it will create the potential as well
        /// </summary>
        /// <param name="contextId"></param>
        /// <param name="newrfqId"></param>
        /// <returns></returns>
        protected void createLead(String contextId, String newrfqId, bool createPotn)
        {
            BackEndObjects.RFQDetails  rfqObjForLead = BackEndObjects.RFQDetails.getRFQDetailsbyIdDB(contextId);
            BackEndObjects.RFQResponse rfqRespObj    = BackEndObjects.RFQResponse.
                                                       getRFQResponseforRFQIdandResponseEntityIdDB(rfqObjForLead.getRFQId(),
                                                                                                   Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

            BackEndObjects.RFQShortlisted potObj = new RFQShortlisted();
            if (createPotn)
            {
                potObj = RFQShortlisted.
                         getRFQShortlistedbyRespEntandRFQId(rfqRespObj.getRespEntityId(), rfqRespObj.getRFQId());
            }

            Dictionary <String, RFQResponseQuotes> leadRespDict = BackEndObjects.RFQResponseQuotes.getAllResponseQuotesforRFQandResponseEntityDB(rfqObjForLead.getRFQId(),
                                                                                                                                                 Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());

            ArrayList rfqSpecListForLead = BackEndObjects.RFQProductServiceDetails.getAllProductServiceDetailsbyRFQIdDB(rfqObjForLead.getRFQId());
            ArrayList rfqQntyListForLead = BackEndObjects.RFQProdServQnty.getRFQProductServiceQuantityforRFIdDB(rfqObjForLead.getRFQId());

            rfqObjForLead.setRFQName(TextBox_Name.Text);
            rfqObjForLead.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            rfqObjForLead.setRFQId(newrfqId);
            rfqObjForLead.setReqId("");//Remove tagged requirements
            rfqObjForLead.setNDADocPath("");

            for (int i = 0; i < rfqSpecListForLead.Count; i++)
            {
                BackEndObjects.RFQProductServiceDetails rfqSpecObj = (BackEndObjects.RFQProductServiceDetails)rfqSpecListForLead[i];
                rfqSpecObj.setRFQId(rfqObjForLead.getRFQId());
                rfqSpecObj.setImgPath("");
            }
            rfqObjForLead.setRFQProdServList(rfqSpecListForLead);
            for (int i = 0; i < rfqQntyListForLead.Count; i++)
            {
                BackEndObjects.RFQProdServQnty rfqQntyObj = (BackEndObjects.RFQProdServQnty)rfqQntyListForLead[i];
                rfqQntyObj.setRFQId(rfqObjForLead.getRFQId());
            }
            rfqObjForLead.setRFQProdServQntyList(rfqQntyListForLead);

            rfqRespObj.setRespDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            rfqRespObj.setNdaPath("");
            rfqRespObj.setRFQId(rfqObjForLead.getRFQId());

            ArrayList rfqRespQuoteList = new ArrayList();

            foreach (KeyValuePair <String, RFQResponseQuotes> kvp in leadRespDict)
            {
                BackEndObjects.RFQResponseQuotes respQuoteObj = kvp.Value;
                respQuoteObj.setRFQId(rfqObjForLead.getRFQId());
                rfqRespQuoteList.Add(respQuoteObj);
            }
            rfqRespObj.setResponseQuoteList(rfqRespQuoteList);

            if (createPotn)
            {
                potObj.setRFQId(rfqObjForLead.getRFQId());
                potObj.setPotentialId(new Id().getNewId(BackEndObjects.Id.ID_TYPE_POTENTIAL_ID_STRING));
                potObj.setCreatedDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                potObj.setConfMatPath("");
            }

            try
            {
                ActionLibrary.SalesActions._createLeads cL = new ActionLibrary.SalesActions._createLeads();

                LeadRecord leadObj = new LeadRecord();
                leadObj.setRFQProdServList(rfqObjForLead.getRFQProdServList());
                leadObj.setRFQId(rfqObjForLead.getRFQId());
                leadObj.setActiveStat(rfqObjForLead.getActiveStat());
                leadObj.setApprovalStat(rfqObjForLead.getApprovalStat());
                leadObj.setCreatedEntity(rfqObjForLead.getCreatedEntity());
                leadObj.setCreatedUsr(rfqObjForLead.getCreatedUsr());
                leadObj.setCreateMode(rfqObjForLead.getCreateMode());
                leadObj.setDueDate(rfqObjForLead.getDueDate());
                leadObj.setEntityId(rfqObjForLead.getEntityId());

                leadObj.setLocalityId(rfqObjForLead.getLocalityId());

                leadObj.setReqId(rfqObjForLead.getReqId());
                leadObj.setRFQName(rfqObjForLead.getRFQName());
                leadObj.setRFQProdServQntyList(rfqObjForLead.getRFQProdServQntyList());
                leadObj.setSubmitDate(rfqObjForLead.getSubmitDate());
                leadObj.setTermsandConds(rfqObjForLead.getTermsandConds());
                leadObj.setCurrency(rfqObjForLead.getCurrency());

                leadObj.setLeadResp(rfqRespObj);

                cL.createNewLead(leadObj, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), User.Identity.Name);
                if (createPotn)
                {
                    RFQShortlisted.insertRFQShorListedEntryDB(potObj);
                }

                Label_Clone_Stat.Visible   = true;
                Label_Clone_Stat.ForeColor = System.Drawing.Color.Green;
                Label_Clone_Stat.Text      = "Cloning Successful. But no existing image or document will be copied.";
            }
            catch (Exception ex)
            {
                Label_Clone_Stat.Visible   = true;
                Label_Clone_Stat.ForeColor = System.Drawing.Color.Red;
                Label_Clone_Stat.Text      = "Cloning Failed";
            }
        }
Esempio n. 12
0
        public string Render(int ElementId, ControllerContext ContCont)
        {
            API.Elements.TaskController taskController = new API.Elements.TaskController();
            var actionResult = taskController.GetTask((int)ElementId);

            if (actionResult != null && actionResult != actionResult as System.Web.Http.Results.NotFoundResult)
            {
                ScriptTask task = (actionResult as OkNegotiatedContentResult <ScriptTask>).Content;
                ViewBag.TaskType        = task.TaskType;
                ViewBag.WorkDayStart    = DateTime.Parse(string.Format("{0} {1}", DateTime.Now.Date.ToShortDateString(), task.WorkStartTime));
                ViewBag.WorkDayEnd      = DateTime.Parse(string.Format("{0} {1}", DateTime.Now.Date.ToShortDateString(), task.WorkEndTime));
                ViewBag.Timezone        = task.Timezone;
                ViewBag.IsMultiUserTask = task.IsMultiUserTask;
                ViewBag.DeleteEnabled   = task.DeleteEnabled;
                ViewBag.UpdateEnabled   = task.UpdateEnabled;

                ViewBag.AddCustomButton  = task.AddCustomButton;
                ViewBag.CustomButtonText = task.CustomButtonText;
                ViewBag.CustomButtonURL  = task.CustomButtonURL;

                ViewBag.ShowStartDate  = task.ShowStartDate;
                ViewBag.ShowEndDate    = task.ShowEndDate;
                ViewBag.ShowAllDay     = task.ShowAllDay;
                ViewBag.ShowRepeatRule = task.ShowRepeatRule;

                ViewBag.DayView      = false;
                ViewBag.WorkWeekView = false;
                ViewBag.WeekView     = false;
                ViewBag.MonthView    = false;
                ViewBag.AgendaView   = false;

                switch (task.DefaultView)
                {
                case "DayView":
                    ViewBag.DayView = true;
                    break;

                case "WorkWeekView":
                    ViewBag.WorkWeekView = true;
                    break;

                case "WeekView":
                    ViewBag.WeekView = true;
                    break;

                case "MonthView":
                    ViewBag.MonthView = true;
                    break;

                case "AgendaView":
                    ViewBag.AgendaView = true;
                    break;

                default:
                    ViewBag.WorkWeekView = true;
                    break;
                }

                ViewBag.LeadName = string.Empty;
                SessionControl.SessionManager.StoreScriptParameter("FilterTask", task.FilterTask, ContCont.HttpContext.Session);

                if (task.EndTimeMinute != 0)
                {
                    SessionControl.SessionManager.StoreScriptParameter("EndTimeMinute", task.EndTimeMinute.ToString(), ContCont.HttpContext.Session);
                }

                if (!string.IsNullOrEmpty(SessionControl.SessionManager.GetProgramParameterByKey("LeadID", ContCont.HttpContext.Session)))
                {
                    LeadRecord lead = taskService.GetLead(SessionControl.SessionManager.GetProgramParameterByKey("LeadID", ContCont.HttpContext.Session));
                    if (lead != null)
                    {
                        ViewBag.LeadName = string.Format("{0} {1}", lead.FirstName, lead.LastName);
                    }
                }

                string clientId = SessionControl.SessionManager.GetClientId(ContCont.HttpContext.Session);
                string userId   = SessionControl.SessionManager.GetUserId(ContCont.HttpContext.Session);
                IQueryable <ContactTaskViewModel> lstTask = null;

                switch (task.FilterTask)
                {
                case "CLIENT":
                    lstTask = taskService.GetAll(clientId);
                    break;

                case "USER":
                    lstTask = taskService.GetAll(clientId, userId);
                    break;
                }

                return(RenderHelper.RenderViewToString(ContCont, "~/Views/Task/Index.cshtml", lstTask, ViewData));
            }

            return("");
        }