Exemple #1
0
        private void LoadRecordForEdit()
        {
            int CallId;

            if (Request.QueryString["CallId"] != null)
            {
                CallId            = Convert.ToInt32(Request.QueryString["CallId"]);
                objDailySalesCall = new DailySalesCallBLL();

                IDailySalesCall objSalesCall = objDailySalesCall.GetDailySalesCallEntry(CallId);
                txtCallDate.Text             = objSalesCall.CallDate.ToString("dd/MM/yyyy");
                ddlCallType.SelectedValue    = objSalesCall.CallType.ToString();
                ddlCustomer.SelectedValue    = objSalesCall.CustomerId.ToString();
                ddlProspectFor.SelectedValue = objSalesCall.ProspectId.ToString();

                if (objSalesCall.NextCallDate.HasValue)
                {
                    txtNextCallDate.Text = objSalesCall.NextCallDate.Value.ToString("dd/MM/yyyy");
                }

                txtRemarks.Text = objSalesCall.Remarks;

                List <ICommitment> lstCommitment = objDailySalesCall.GetCommitments(CallId);
                ViewState["CommittmentDetails"] = lstCommitment;
                RefreshGridView();
            }
        }
        public static int SaveDailySalesCall(IDailySalesCall dailySalesCall)
        {
            string strExecution = "[common].[uspSaveDailySalesCall]";
            int    result       = 0;

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@pk_CallID", dailySalesCall.CallId);
                oDq.AddIntegerParam("@fk_UserID", dailySalesCall.UserId);
                oDq.AddIntegerParam("@fk_CustID", dailySalesCall.CustomerId);
                oDq.AddIntegerParam("@fk_CallType", dailySalesCall.CallType);
                oDq.AddIntegerParam("@fk_ProspectID", dailySalesCall.ProspectId);

                oDq.AddDateTimeParam("@CallDate", dailySalesCall.CallDate);
                oDq.AddDateTimeParam("@NextCallOn", dailySalesCall.NextCallDate);

                oDq.AddVarcharParam("@Remarks", 200, dailySalesCall.Remarks);

                oDq.AddIntegerParam("@fk_UserAdded", dailySalesCall.CreatedBy);
                oDq.AddIntegerParam("@fk_UserLastEdited", dailySalesCall.ModifiedBy);

                oDq.AddIntegerParam("@Result", result, QueryParameterDirection.Output);
                oDq.RunActionQuery();
                result = Convert.ToInt32(oDq.GetParaValue("@Result"));
            }

            return(result);
        }
Exemple #3
0
        private bool ValidateSave(IDailySalesCall dailySales)
        {
            bool isValid = true;

            spnCallDate.Style["display"]     = "none";
            spnNextCallDate.Style["display"] = "none";
            spnCallType.Style["display"]     = "none";
            spnCustomer.Style["display"]     = "none";
            spnProspect.Style["display"]     = "none";

            if (dailySales.CallDate == DateTime.MinValue)
            {
                isValid = false;
                spnCallDate.Style["display"] = "";
            }
            else
            {
                if (!IsValidCallDate())
                {
                    isValid = false;
                    spnCallDate.InnerHtml        = "Invalid Call Date";
                    spnCallDate.Style["display"] = "";
                }
            }

            if (dailySales.NextCallDate != DateTime.MinValue)
            {
                if (!IsValidNextCallDate())
                {
                    isValid = false;
                    spnNextCallDate.InnerHtml        = "Next Call Date should be future date";
                    spnNextCallDate.Style["display"] = "";
                }
            }

            if (dailySales.CallType == 0)
            {
                isValid = false;
                spnCallType.Style["display"] = "";
            }

            if (dailySales.CustomerId == 0)
            {
                isValid = false;
                spnCustomer.Style["display"] = "";
            }

            if (dailySales.ProspectId == 0)
            {
                isValid = false;
                spnProspect.Style["display"] = "";
            }
            return(isValid);
        }
        public static IDailySalesCall GetDailySalesCallEntry(int callId)
        {
            string          strExecution = "[common].[uspGetDailySalesCall]";
            IDailySalesCall salesCall    = null;

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@CallId", callId);
                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    salesCall = new DailySalesCallEntity(reader);
                }

                reader.Close();
            }
            return(salesCall);
        }
        public static IDailySalesCall GetSalesExecutiveByCallId(int callId)
        {
            string          strExecution = "[common].[uspGetSalesExecutiveByCallId]";
            IDailySalesCall salesCall    = null;

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@CallId", callId);
                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    salesCall          = new DailySalesCallEntity();
                    salesCall.UserName = Convert.ToString(reader["UserName"]);
                }

                reader.Close();
            }
            return(salesCall);
        }
        public int SaveDailySalesCallEntry(IDailySalesCall dailySalesCall, List <ICommitment> commitments)
        {
            int callId       = 0;
            int commitmentId = 0;

            callId = DailySalesCallDAL.SaveDailySalesCall(dailySalesCall);

            if (callId > 0)
            {
                if (!ReferenceEquals(commitments, null))
                {
                    foreach (ICommitment commitment in commitments)
                    {
                        commitment.CallId = callId;
                        commitmentId      = DailySalesCallDAL.SaveCommitment(commitment);
                    }
                }
            }

            return(callId);
        }
Exemple #7
0
        private void BuildDailySalesEntity(IDailySalesCall dailySales)
        {
            int CallId;

            dailySales.CallDate = GetDate(txtCallDate.Text.Trim());

            if (txtNextCallDate.Text.Trim() != string.Empty)
            {
                dailySales.NextCallDate = GetDate(txtNextCallDate.Text.Trim());
            }
            else
            {
                dailySales.NextCallDate = null;
            }

            //For Add
            dailySales.CallId = 0;

            //For Edit
            dailySales.CallType   = Convert.ToInt32(ddlCallType.SelectedValue);
            dailySales.CustomerId = Convert.ToInt32(ddlCustomer.SelectedValue);
            dailySales.ProspectId = Convert.ToInt32(ddlProspectFor.SelectedValue);
            dailySales.Remarks    = txtRemarks.Text.ToUpper();
            dailySales.UserId     = ((IUser)Session[Constants.SESSION_USER_INFO]).Id;

            if (Request.QueryString["CallId"] != null)
            {
                //For Edit
                dailySales.ModifiedBy = _userId;
                CallId            = Convert.ToInt32(Request.QueryString["CallId"]);
                dailySales.CallId = CallId;
            }
            else
            {
                //For Add
                dailySales.CallId    = 0;
                dailySales.CreatedBy = ((IUser)Session[Constants.SESSION_USER_INFO]).Id;;
            }
        }