aspx 页面



<asp:Literal ID="litTable" runat="server"></asp:Literal>



<asp:HiddenField ID="hiddenDailyDetailCount" runat="server" />
    <asp:HiddenField ID="hiddenDailyDetailDel" runat="server" />
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {

            var n = 0;
            if ($("#<%= hiddenDailyDetailCount.ClientID %>").attr("value") != "")
                n = $("#<%= hiddenDailyDetailCount.ClientID %>").attr("value");
            $("#btnAddDailyDetailRow").click(function () {

                var res = "";
                res = res + "<tr class=\"table_none table_none_NoWidth\" id=\"RowDailyDetail" + n + "\">\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtContactPerson" + n + "\" style=\"width:80px;\" type=\"text\" value=\"\" title=\"请输入联系人\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtTelephoneNO" + n + "\" style=\"width:100px;\" type=\"text\" value=\"\" title=\"请输入电话~noChinese\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtAddress" + n + "\" style=\"width:120px;\" type=\"text\" value=\"\" title=\"请输入地址\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtNetworkAddress" + n + "\" style=\"width:120px;\" type=\"text\" value=\"\" title=\"请输入网址\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtRegion" + n + "\" style=\"width:80px;\" type=\"text\" value=\"\" title=\"请输入地域\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtTrade" + n + "\" style=\"width:80px;\" type=\"text\" value=\"\" title=\"请输入行业\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><select name=\"selCustomerLevelID" + n + "\" id=\"selCustomerLevelID" + n + "\" style=\"width:100px;\" title=\"请选择等级~!\" >" + strCustomerLevelOptions + "</select></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtStage" + n + "\" style=\"width:50px;\" type=\"text\" value=\"\" title=\"请输入阶段\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtPreSignatureTime" + n + "\" οnfοcus=\"javascript:HS_setDate(this);\" style=\"width:80px;\" type=\"text\" value=\"\" title=\"请输入预签单时间~date!\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtNextFollowUpTime" + n + "\" οnfοcus=\"javascript:HS_setDate(this);\" style=\"width:80px;\" type=\"text\" value=\"\" title=\"请输入下次跟单日期~date!\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><textarea name=\"txtFollowUpState" + n + "\" style=\"width:120px;height:40px;\" value=\"\" title=\"请输入跟进情况\" ></textarea></td>\r\n";
                res = res + "<td width=\"80\" align=\"center\"><p align=\"center\"><a href=\"javascript:RowDailyDetailDel(" + n + ");\" class=\"DailyDetailDel\"><img src=\"\" alt=\"删除\" style=\"border:0px;\"></a></p></td>\r\n";
                res = res + "</tr>\r\n";

                $("#tblDailyDetail").append(res);
                $("#<%= hiddenDailyDetailCount.ClientID %>").attr("value",parseInt(n) + 1);
                n++;
            });
        });
    </script>
    <asp:Literal ID="litScripts" runat="server"></asp:Literal>



.cs 代码



#region 新增
        /// <summary>
        /// 新增
        /// </summary>
        private void DoNew()
        {
            txtDailyTime.Text = DateTime.Now.Date.ToString("yyyy/MM/dd");

            #region 动态行
            string strCustomerLevelOptions = GetCustomerLevelHtml(0);
            litTable.Text = GetNewTableHtml();
            //客户等级选项 脚本全局变量
            litScripts.Text += "<script language=\"javaScript\" type=\"text/javascript\">var strCustomerLevelOptions = '" + strCustomerLevelOptions + "';</script>\r\n";
            litScripts.Text += GetScript();
            #endregion
        }

        /// <summary>
        /// 新增时动态表格
        /// </summary>
        /// <returns></returns>
        private string GetNewTableHtml()
        {
            string res = "";
            res += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"tblDailyDetail\">\r\n";
            res += "<tr class=\"table_body table_body_NoWidth\">\r\n";
            res += "<td width=\"150\"><p align=\"center\">联系人</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">电话</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">地址</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">网址</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">地域</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">行业</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">级别</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">阶段</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">预签单时间</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">下次跟进日期</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">跟进情况</p></td>\r\n";
            res += "<td width=\"80\"><p align=\"center\">操作</p></td>\r\n";
            res += "</tr>\r\n";
            res += "</table>\r\n";
            return res;
        }

        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="sat"></param>
        private void DoNewPost()
        {
            int OutRecordID = 0;
            BU_DailyTable mRecord = new BU_DailyTable();
            sys_UserTable mUser = BusinessFacade.sys_UserDisp(Common.Get_UserID);

            mRecord.DailyID = S_ID;
            mRecord.TelephoneVisitCount = (int)Common.sink(txtTelephoneVisitCount.UniqueID, MethodType.Post, 255, 1, DataType.Int, spanTelephoneVisitCount.InnerText);
            mRecord.VisitCount = (int)Common.sink(txtVisitCount.UniqueID, MethodType.Post, 255, 1, DataType.Int, spanVisitCount.InnerText);
            mRecord.NewIntentionCustomerCount = (int)Common.sink(txtNewIntentionCustomerCount.UniqueID, MethodType.Post, 255, 1, DataType.Int, spanNewIntentionCustomerCount.InnerText);
            mRecord.LeaderReview = txtLeaderReview.Text.Trim();
            mRecord.Review = false;//默认未审核
            mRecord.CreateById = mRecord.ModifyById = mUser.UserID;
            mRecord.CreateByName = mRecord.ModifyByName = mUser.U_CName;
            mRecord.CreateDate = mRecord.ModifyDate = DateTime.Now;
            mRecord.DB_Option_Action_ = DBOptionAction.Insert;
            BusinessFacade.BU_DailyInsertUpdate(mRecord, out OutRecordID);

            //动态行
            DoNewPostDynamicRow(OutRecordID, mUser);
        }

        /// <summary>
        /// 处理新增时动态行的数据提交
        /// </summary>
        private void DoNewPostDynamicRow(int DailyID, sys_UserTable mUser)
        {
            int TrCount = 0; //总行数
            string[] DelRowId_Array = hiddenDailyDetailDel.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); //删除行Id数组
            try
            {
                TrCount = Convert.ToInt32(hiddenDailyDetailCount.Value);
            }
            catch { }

            for (int i = 0; i < TrCount; i++)
            {
                if (HasDeletedRow(i.ToString(), DelRowId_Array))
                {
                    continue;
                }

                BU_DailyDetailTable mRecord = new BU_DailyDetailTable();
                mRecord.DailyID = DailyID;
                mRecord.ContactPerson = (string)Common.sink("txtContactPerson" + i, MethodType.Post, 255, 0, DataType.Str, "联系人");
                mRecord.TelephoneNO = (string)Common.sink("txtTelephoneNO" + i, MethodType.Post, 255, 0, DataType.Str, "电话");
                mRecord.Address = (string)Common.sink("txtAddress" + i, MethodType.Post, 255, 0, DataType.Str, "地址");
                mRecord.NetworkAddress = (string)Common.sink("txtNetworkAddress" + i, MethodType.Post, 255, 0, DataType.Str, "网址");
                mRecord.Region = (string)Common.sink("txtRegion" + i, MethodType.Post, 255, 0, DataType.Str, "地域");
                mRecord.Trade = (string)Common.sink("txtTrade" + i, MethodType.Post, 255, 0, DataType.Str, "行业");
                mRecord.CustomerLevelID = (int)Common.sink("selCustomerLevelID" + i, MethodType.Post, 255, 0, DataType.Int, "等级");
                mRecord.Stage = (string)Common.sink("txtStage" + i, MethodType.Post, 255, 0, DataType.Str, "阶段");
                mRecord.PreSignatureTime = (DateTime)Common.sink("txtPreSignatureTime" + i, MethodType.Post, 255, 0, DataType.Dat, "预签单时间");
                mRecord.NextFollowUpTime = (DateTime)Common.sink("txtNextFollowUpTime" + i, MethodType.Post, 255, 0, DataType.Dat, "下次跟单日期");
                mRecord.FollowUpState = (string)Common.sink("txtFollowUpState" + i, MethodType.Post, 255, 0, DataType.Str, "跟进情况");
                mRecord.CreateById = mRecord.ModifyById = mUser.UserID;
                mRecord.CreateByName = mRecord.ModifyByName = mUser.U_CName;
                mRecord.CreateDate = mRecord.ModifyDate = DateTime.Now;
                mRecord.DB_Option_Action_ = DBOptionAction.Insert;
                BusinessFacade.BU_DailyDetailInsertUpdate(mRecord);
            }
        }
        #endregion

        #region 修改
        /// <summary>
        /// 修改
        /// </summary>
        private void DoEdit()
        {
            if (S_ID == 0) return;
            BU_DailyTable mRecord = BusinessFacade.BU_DailyDisp(S_ID);
            if (mRecord.DailyID == 0) return;

            this.txtDailyTime.Text = mRecord.CreateDate.Value.ToString("yyyy/MM/dd");
            this.txtTelephoneVisitCount.Text = mRecord.TelephoneVisitCount.ToString();
            this.txtVisitCount.Text = mRecord.VisitCount.ToString();
            this.txtNewIntentionCustomerCount.Text = mRecord.NewIntentionCustomerCount.ToString();
            this.txtLeaderReview.Text = mRecord.LeaderReview.ToString();

            #region 动态行
            QueryParam qp = new QueryParam();
            qp.Where = " Where DailyID=" + S_ID;
            qp.Orderfld = "DailyDetailID";
            qp.OrderType = 0;
            int RecordCount = 0;
            ArrayList lst = BusinessFacade.BU_DailyDetailList(qp, out RecordCount);
            IList<BU_DailyDetailTable> mList = lst.Cast<BU_DailyDetailTable>().ToList();

            string strCustomerLevelOptions = GetCustomerLevelHtml(0);
            hiddenDailyDetailCount.Value = mList.Count.ToString();
            litTable.Text= GetEditTableHtml(mList);
            //客户等级选项 脚本全局变量
            litScripts.Text += "<script language=\"javaScript\" type=\"text/javascript\">var strCustomerLevelOptions = '" + strCustomerLevelOptions + "';</script>\r\n";
            litScripts.Text += GetScript();
            #endregion
        }

        /// <summary>
        /// 修改时动态表格
        /// </summary>
        /// <returns></returns>
        private string GetEditTableHtml(IList<BU_DailyDetailTable> mList)
        {
            string res = "";
            res += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"tblDailyDetail\">\r\n";
            res += "<tr class=\"table_body table_body_NoWidth\">\r\n";
            res += "<td width=\"150\"><p align=\"center\">联系人</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">电话</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">地址</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">网址</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">地域</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">行业</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">级别</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">阶段</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">预签单时间</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">下次跟进日期</p></td>\r\n";
            res += "<td width=\"150\"><p align=\"center\">跟进情况</p></td>\r\n";
            res += "<td width=\"80\"><p align=\"center\">操作</p></td>\r\n";
            res += "</tr>\r\n";

            int n = 0;
            foreach (BU_DailyDetailTable m in mList)
            {
                res = res + "<input name=\"hdDailyDetailID" + n + "\" type=\"hidden\" value=\"" + m.DailyDetailID + "\" />\r\n"; //加一列隐藏ID
                res = res + "<tr class=\"table_none table_none_NoWidth\" id=\"RowDailyDetail" + n + "\">\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtContactPerson" + n + "\" style=\"width:80px;\" type=\"text\" value=\"" + m.ContactPerson.Trim() + "\" title=\"请输入联系人\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtTelephoneNO" + n + "\" style=\"width:100px;\" type=\"text\" value=\"" + m.TelephoneNO.Trim() + "\" title=\"请输入电话~noChinese\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtAddress" + n + "\" style=\"width:120px;\" type=\"text\" value=\"" + m.Address.Trim() + "\" title=\"请输入地址\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtNetworkAddress" + n + "\" style=\"width:120px;\" type=\"text\" value=\"" + m.NetworkAddress.Trim() + "\" title=\"请输入网址\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtRegion" + n + "\" style=\"width:80px;\" type=\"text\" value=\"" + m.Region.Trim() + "\" title=\"请输入地域\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtTrade" + n + "\" style=\"width:80px;\" type=\"text\" value=\"" + m.Trade.Trim() + "\" title=\"请输入行业\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><select name=\"selCustomerLevelID" + n + "\" id=\"selCustomerLevelID" + n + "\" style=\"width:100px;\" title=\"请选择等级~!\" >" + GetCustomerLevelHtml(m.CustomerLevelID.Value) + "</select></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtStage" + n + "\" style=\"width:50px;\" type=\"text\" value=\"" + m.Stage.Trim() + "\" title=\"请输入阶段\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtPreSignatureTime" + n + "\" οnfοcus=\"javascript:HS_setDate(this);\" style=\"width:80px;\" type=\"text\" value=\"" + m.PreSignatureTime.Value.ToString("yyyy-MM-dd") + "\" title=\"请输入预签单时间~date!\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><input name=\"txtNextFollowUpTime" + n + "\" οnfοcus=\"javascript:HS_setDate(this);\" style=\"width:80px;\" type=\"text\" value=\"" + m.NextFollowUpTime.Value.ToString("yyyy-MM-dd") + "\" title=\"请输入下次跟单日期~date!\" /></td>\r\n";
                res = res + "<td width=\"150\" align=\"center\"><textarea name=\"txtFollowUpState" + n + "\" style=\"width:120px;height:40px;\" value=\"" + m.FollowUpState.Trim() + "\" title=\"请输入跟进情况\" >" + m.FollowUpState.Trim() + "</textarea></td>\r\n";
                res = res + "<td width=\"80\" align=\"center\"><p align=\"center\"><a href=\"javascript:RowDailyDetailDel(" + n + ");\" class=\"DailyDetailDel\"><img src=\"\" alt=\"删除\" style=\"border:0px;\"></a></p></td>\r\n";
                res = res + "</tr>\r\n";
                n++;
            }

            res += "</table>\r\n";
            return res;
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sat"></param>
        private void DoEditPost()
        {
            BU_DailyTable mRecord = new BU_DailyTable();
            if (S_ID == 0) return;
            mRecord = BusinessFacade.BU_DailyDisp(S_ID);
            if (mRecord.DailyID == 0) return;
            sys_UserTable mUser = BusinessFacade.sys_UserDisp(Common.Get_UserID);

            mRecord.DailyID = S_ID;
            mRecord.TelephoneVisitCount = (int)Common.sink(txtTelephoneVisitCount.UniqueID, MethodType.Post, 255, 1, DataType.Int, spanTelephoneVisitCount.InnerText);
            mRecord.VisitCount = (int)Common.sink(txtVisitCount.UniqueID, MethodType.Post, 255, 1, DataType.Int, spanVisitCount.InnerText);
            mRecord.NewIntentionCustomerCount = (int)Common.sink(txtNewIntentionCustomerCount.UniqueID, MethodType.Post, 255, 1, DataType.Int, spanNewIntentionCustomerCount.InnerText);
            mRecord.LeaderReview = txtLeaderReview.Text.Trim();
            mRecord.CreateById = mRecord.ModifyById = mUser.UserID;
            mRecord.CreateByName = mRecord.ModifyByName = mUser.U_CName;
            mRecord.CreateDate = mRecord.ModifyDate = DateTime.Now;
            mRecord.DB_Option_Action_ = DBOptionAction.Update;
            BusinessFacade.BU_DailyInsertUpdate(mRecord);

            //动态行
            DoEditPostDynamicRow(mRecord, mUser);
        }

        /// <summary>
        /// 处理新增时动态行的数据提交
        /// </summary>
        private void DoEditPostDynamicRow(BU_DailyTable mDaily, sys_UserTable mUser)
        {
            #region 删除数据行
            //即:删除 hiddenDailyDetailDel 中ID 不等于0的行(因为ID等于0的行可能是新增行,然后被删除了)
            string[] DelRowId_Array = hiddenDailyDetailDel.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); //删除行Id数组
            int DailyDetailIDDeleted = 0;
            foreach (string Id in DelRowId_Array)
            {
                try
                {
                    DailyDetailIDDeleted = Convert.ToInt32(Request["hdDailyDetailID" + Convert.ToInt32(Id)]);
                }
                catch
                {
                    DailyDetailIDDeleted = 0;
                }
                if (DailyDetailIDDeleted != 0)
                {
                    BU_DailyDetailTable mRecord = new BU_DailyDetailTable();
                    mRecord.DailyDetailID = Convert.ToInt32(DailyDetailIDDeleted);
                    mRecord.DB_Option_Action_ = DBOptionAction.Delete;
                    BusinessFacade.BU_DailyDetailInsertUpdate(mRecord);
                }
            }
            #endregion

            #region 处理修改的数据行和新增行
            int TrCount = 0; //总行数
            try
            {
                TrCount = Convert.ToInt32(hiddenDailyDetailCount.Value);
            }
            catch { }

            int DailyDetailID = 0;
            for (int i = 0; i < TrCount; i++)
            {
                if (HasDeletedRow(i.ToString(), DelRowId_Array))
                {
                    continue;
                }

                try
                {
                    DailyDetailID = Convert.ToInt32(Request["hdDailyDetailID" + i]);
                }
                catch { }

                if (DailyDetailID == 0) //新增行
                {
                    BU_DailyDetailTable mRecord = new BU_DailyDetailTable();
                    mRecord.DailyID = mDaily.DailyID;
                    mRecord.ContactPerson = (string)Common.sink("txtContactPerson" + i, MethodType.Post, 255, 0, DataType.Str, "联系人");
                    mRecord.TelephoneNO = (string)Common.sink("txtTelephoneNO" + i, MethodType.Post, 255, 0, DataType.Str, "电话");
                    mRecord.Address = (string)Common.sink("txtAddress" + i, MethodType.Post, 255, 0, DataType.Str, "地址");
                    mRecord.NetworkAddress = (string)Common.sink("txtNetworkAddress" + i, MethodType.Post, 255, 0, DataType.Str, "网址");
                    mRecord.Region = (string)Common.sink("txtRegion" + i, MethodType.Post, 255, 0, DataType.Str, "地域");
                    mRecord.Trade = (string)Common.sink("txtTrade" + i, MethodType.Post, 255, 0, DataType.Str, "行业");
                    mRecord.CustomerLevelID = (int)Common.sink("selCustomerLevelID" + i, MethodType.Post, 255, 0, DataType.Int, "等级");
                    mRecord.Stage = (string)Common.sink("txtStage" + i, MethodType.Post, 255, 0, DataType.Str, "阶段");
                    mRecord.PreSignatureTime = (DateTime)Common.sink("txtPreSignatureTime" + i, MethodType.Post, 255, 0, DataType.Dat, "预签单时间");
                    mRecord.NextFollowUpTime = (DateTime)Common.sink("txtNextFollowUpTime" + i, MethodType.Post, 255, 0, DataType.Dat, "下次跟单日期");
                    mRecord.FollowUpState = (string)Common.sink("txtFollowUpState" + i, MethodType.Post, 255, 0, DataType.Str, "跟进情况");
                    mRecord.CreateById = mRecord.ModifyById = mUser.UserID;
                    mRecord.CreateByName = mRecord.ModifyByName = mUser.U_CName;
                    mRecord.CreateDate = mRecord.ModifyDate = DateTime.Now;
                    mRecord.DB_Option_Action_ = DBOptionAction.Insert;
                    BusinessFacade.BU_DailyDetailInsertUpdate(mRecord);
                }
                else //修改数据行
                {
                    BU_DailyDetailTable mRecord = BusinessFacade.BU_DailyDetailDisp(DailyDetailID);
                    mRecord.DailyID = mDaily.DailyID;
                    mRecord.ContactPerson = (string)Common.sink("txtContactPerson" + i, MethodType.Post, 255, 0, DataType.Str, "联系人");
                    mRecord.TelephoneNO = (string)Common.sink("txtTelephoneNO" + i, MethodType.Post, 255, 0, DataType.Str, "电话");
                    mRecord.Address = (string)Common.sink("txtAddress" + i, MethodType.Post, 255, 0, DataType.Str, "地址");
                    mRecord.NetworkAddress = (string)Common.sink("txtNetworkAddress" + i, MethodType.Post, 255, 0, DataType.Str, "网址");
                    mRecord.Region = (string)Common.sink("txtRegion" + i, MethodType.Post, 255, 0, DataType.Str, "地域");
                    mRecord.Trade = (string)Common.sink("txtTrade" + i, MethodType.Post, 255, 0, DataType.Str, "行业");
                    mRecord.CustomerLevelID = (int)Common.sink("selCustomerLevelID" + i, MethodType.Post, 255, 0, DataType.Int, "等级");
                    mRecord.Stage = (string)Common.sink("txtStage" + i, MethodType.Post, 255, 0, DataType.Str, "阶段");
                    mRecord.PreSignatureTime = (DateTime)Common.sink("txtPreSignatureTime" + i, MethodType.Post, 255, 0, DataType.Dat, "预签单时间");
                    mRecord.NextFollowUpTime = (DateTime)Common.sink("txtNextFollowUpTime" + i, MethodType.Post, 255, 0, DataType.Dat, "下次跟单日期");
                    mRecord.FollowUpState = (string)Common.sink("txtFollowUpState" + i, MethodType.Post, 255, 0, DataType.Str, "跟进情况");
                    mRecord.ModifyById = mUser.UserID;
                    mRecord.ModifyByName = mUser.U_CName;
                    mRecord.ModifyDate = DateTime.Now;
                    mRecord.DB_Option_Action_ = DBOptionAction.Update;
                    BusinessFacade.BU_DailyDetailInsertUpdate(mRecord);
                }
            }
            #endregion
        }


        #endregion

        #region 删除
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sat"></param>
        private void DoDeletePost()
        {
            BU_DailyTable mRecord = new BU_DailyTable();
            mRecord.DailyID = S_ID;
            mRecord.DB_Option_Action_ = DBOptionAction.Delete;
            BusinessFacade.BU_DailyInsertUpdate(mRecord);

            //删除明细
            QueryParam qp = new QueryParam();
            qp.Where = " Where DailyID=" + S_ID;
            qp.Orderfld = "DailyDetailID";
            qp.OrderType = 0;
            int RecordCount = 0;
            ArrayList lst = BusinessFacade.BU_DailyDetailList(qp, out RecordCount);
            IList<BU_DailyDetailTable> mList = lst.Cast<BU_DailyDetailTable>().ToList();
            foreach (BU_DailyDetailTable m in mList)
            {
                BU_DailyDetailTable mDailyDetail = new BU_DailyDetailTable();
                mDailyDetail.DailyDetailID = m.DailyDetailID;
                mDailyDetail.DB_Option_Action_ = DBOptionAction.Delete;
                BusinessFacade.BU_DailyDetailInsertUpdate(mDailyDetail);
            }
        }
        #endregion

        #region 查看
        /// <summary>
        /// 查看
        /// </summary>
        private void DoLook()
        {
            if (S_ID == 0) return;
            BU_DailyTable mRecord = BusinessFacade.BU_DailyDisp(S_ID);
            if (mRecord.DailyID == 0) return;

            this.lblDailyTime.Text = mRecord.CreateDate.Value.ToString("yyyy/MM/dd");
            this.lblTelephoneVisitCount.Text = mRecord.TelephoneVisitCount.ToString();
            this.lblVisitCount.Text = mRecord.VisitCount.ToString();
            this.lblNewIntentionCustomerCount.Text = mRecord.NewIntentionCustomerCount.ToString();
            this.lblLeaderReview.Text = mRecord.LeaderReview.ToString();

            QueryParam qp = new QueryParam();
            qp.Where = " Where DailyID="+S_ID;
            qp.Orderfld = "DailyDetailID";
            qp.OrderType = 0;
            int RecordCount = 0;
            ArrayList lst = BusinessFacade.BU_DailyDetailList(qp, out RecordCount);
            gvDailyDetail.DataSource = lst;
            gvDailyDetail.DataBind();
        }
        #endregion

        #region 公共方法
        /// <summary>
        /// 设置标题
        /// </summary>
        /// <param name="CMD_Txt"></param>
        /// <param name="App_Txt"></param>
        private void SetTitles(string CMD_Txt, string App_Txt)
        {
            All_Title_Txt = CMD_Txt + App_Txt;
            HeadMenuWebControls1.HeadOPTxt = TabOptionItem1.Tab_Name = All_Title_Txt;
        }

        /// <summary>
        /// 该行是否已经被删除
        /// </summary>
        /// <param name="strRowId"></param>
        /// <param name="DelRowId_Array"></param>
        /// <returns></returns>
        private bool HasDeletedRow(string strRowId, string[] DelRowId_Array)
        {
            foreach (string strId in DelRowId_Array)
            {
                if (strRowId == strId)
                {
                    return true;
                }
            }

            return false;
        }

        /// <summary>
        /// 删除行脚本
        /// </summary>
        /// <returns></returns>
        private string GetScript()
        {
            string res = "";
            res = res + "<script language=\"JavaScript\" type=\"text/javascript\">\r\n";
            string variableName = "DailyDetail";

            res = res + "function Row" + variableName + "Del(i)\r\n";
            res = res + "{\r\n";
            res = res + "$(\"#Row" + variableName + "\"+i).remove();\r\n";
            res = res + "$(\"#" + hiddenDailyDetailDel.ClientID + "\").attr(\"value\",i+\",\" + $(\"#" + hiddenDailyDetailDel.ClientID + "\").attr(\"value\"));\r\n";
            res = res + "}\r\n";

            res = res + "</script>\r\n";
            return res;
        }

        /// <summary>
        /// 客户登记下拉框选项
        /// </summary>
        /// <param name="mList"></param>
        /// <param name="selValue"></param>
        /// <returns></returns>
        private string GetCustomerLevelHtml(int selValue)
        {
            QueryParam qp = new QueryParam();
            qp.Where = this.SearchTerms;
            qp.Orderfld = "LevelID";
            qp.OrderType = 0;
            int RecordCount = 0;
            ArrayList lst = BusinessFacade.BU_CustomerLevelList(qp, out RecordCount);
            IList<BU_CustomerLevelTable> mList = lst.Cast<BU_CustomerLevelTable>().ToList();

            string res = "";
            res = res + "<option value=\"0\">-请选择等级-</option>";
            foreach (BU_CustomerLevelTable m in mList)
            {
                if (selValue == m.LevelID)
                {
                    res = res + "<option value=\"" + m.LevelID + "\" selected>" + m.LevelName + "</option>";
                }
                else
                {
                    res = res + "<option value=\"" + m.LevelID + "\">" + m.LevelName + "</option>";
                }
            }
            return res;
        }
        #endregion