Ejemplo n.º 1
0
        protected override string AddData()
        {
            RDFNew.Module.Admin.Bas.Bas_Partner obj = new RDFNew.Module.Admin.Bas.Bas_Partner();
            DataTable dt = RDFNew.Module.DALHelper.GetMasterEmpty(null, "Bas_Partner");
            DataRow dr;
            dr = dt.NewRow();
            dr["PartnerID"] = App_Com.Helper.InputText(this.txtPartnerID.Text, 500);
            dr["PartnerName"] = App_Com.Helper.InputText(this.txtPartnerName.Text, 500);
            dr["PartnerTypeID"] = this.ddlPartnerTypeID.SelectedValue;
            dr["Address"] = App_Com.Helper.InputText(this.txtAddress.Text, 500);
            dr["Linker"] = App_Com.Helper.InputText(this.txtLinker.Text, 500);
            dr["Tel"] = App_Com.Helper.InputText(this.txtTel.Text, 500);
            dr["Fax"] = App_Com.Helper.InputText(this.txtFax.Text, 500);
            dr["Phone"] = App_Com.Helper.InputText(this.txtPhone.Text, 500);
            dr["Email"] = App_Com.Helper.InputText(this.txtEmail.Text, 500);
            dr["QQ"] = App_Com.Helper.InputText(this.txtQQ.Text, 500);
            dr["Enabled"] = this.ckbEnabled.Checked;
            dr["Remark"] = App_Com.Helper.InputText(this.txtRemark.Text, 500);

            dr["CrtBy"] = App_Com.Sys_User.GetUserInfo("UserID");
            dr["CrtOn"] = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            dt.Rows.Add(dr);
            object[] data = obj.ApplyMaster(dt.GetChanges(DataRowState.Added),
                                        App_Com.Helper.BuildLog("Bas_Partner", "add"));
            if (data[0].ToString() != "0") //正常
                throw data[1] as Exception;
            else
                return data[1].ToString();
        }
Ejemplo n.º 2
0
        protected override string UpdateData()
        {
            RDFNew.Module.Admin.Bas.Bas_Partner obj = new RDFNew.Module.Admin.Bas.Bas_Partner();
            object[] data = obj.GetMaster(B_Keyword);
            if (data[0].ToString() == "0") //正常
            {
                DataTable dt = data[1] as DataTable;
                if (dt.Rows.Count > 0)
                {
                    DataRow dr;
                    dr = dt.Rows[0];
                    dr["PartnerName"] = App_Com.Helper.InputText(this.txtPartnerName.Text, 500);
                    dr["Address"] = App_Com.Helper.InputText(this.txtAddress.Text, 500);
                    dr["Linker"] = App_Com.Helper.InputText(this.txtLinker.Text, 500);
                    dr["Tel"] = App_Com.Helper.InputText(this.txtTel.Text, 500);
                    dr["Fax"] = App_Com.Helper.InputText(this.txtFax.Text, 500);
                    dr["Phone"] = App_Com.Helper.InputText(this.txtPhone.Text, 500);
                    dr["Email"] = App_Com.Helper.InputText(this.txtEmail.Text, 500);
                    dr["QQ"] = App_Com.Helper.InputText(this.txtQQ.Text, 500);

                    dr["Enabled"] = this.ckbEnabled.Checked;
                    dr["Remark"] = App_Com.Helper.InputText(this.txtRemark.Text, 500);

                    dr["ModBy"] = App_Com.Sys_User.GetUserInfo("UserID");
                    dr["ModOn"] = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    data = obj.ApplyMaster(dt.GetChanges(DataRowState.Modified),
                                            App_Com.Helper.BuildLog("Bas_Partner", "edit"));
                    if (data[0].ToString() != "0") //正常
                        throw data[1] as Exception;
                    else
                        return data[1].ToString();
                }
                else
                {
                    throw new Exception("需要修改的记录已不存在,请刷新后再试.");
                }
            }
            else
            {
                throw data[1] as Exception;
            }
        }