コード例 #1
0
        public ptOfficeResClass GetModel(string TypeCode)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" select TypeCode,TypeName,Remark,i_xh,IsValid,UserCode,RecordDate,i_ChildNum ");
            builder.Append(" from OA_OfficeRes_Class ");
            builder.Append(" where TypeCode='" + TypeCode + "'");
            ptOfficeResClass class2 = new ptOfficeResClass();
            DataSet          set    = publicDbOpClass.DataSetQuary(builder.ToString());

            if (set.Tables[0].Rows.Count <= 0)
            {
                return(null);
            }
            class2.TypeCode = set.Tables[0].Rows[0]["TypeCode"].ToString();
            class2.TypeName = set.Tables[0].Rows[0]["TypeName"].ToString();
            class2.Remark   = set.Tables[0].Rows[0]["Remark"].ToString();
            if (set.Tables[0].Rows[0]["i_xh"].ToString() != "")
            {
                class2.i_xh = int.Parse(set.Tables[0].Rows[0]["i_xh"].ToString());
            }
            class2.IsValid  = set.Tables[0].Rows[0]["IsValid"].ToString();
            class2.UserCode = set.Tables[0].Rows[0]["UserCode"].ToString();
            if (set.Tables[0].Rows[0]["RecordDate"].ToString() != "")
            {
                class2.RecordDate = DateTime.Parse(set.Tables[0].Rows[0]["RecordDate"].ToString());
            }
            if (set.Tables[0].Rows[0]["i_ChildNum"].ToString() != "")
            {
                class2.i_ChildNum = int.Parse(set.Tables[0].Rows[0]["i_ChildNum"].ToString());
            }
            return(class2);
        }
コード例 #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        ptOfficeResClass data = this.GetData();

        if (this.OperateType == "add")
        {
            int num = this.mcAction.Add(data);
            if (num > 0)
            {
                this.JS.Text = "returnValue=true;window.close();";
            }
            else
            {
                this.JS.Text = "没有相关数据可添加!";
            }
        }
        if (this.OperateType == "upd")
        {
            int num = this.mcAction.Update(data);
            if (num > 0)
            {
                this.JS.Text = "returnValue=true;window.close();";
                return;
            }
            this.JS.Text = "没有相关数据可更新!";
        }
    }
コード例 #3
0
        public int Update(ptOfficeResClass model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" update OA_OfficeRes_Class set ");
            builder.Append(" TypeName='" + model.TypeName + "', ");
            builder.Append(" Remark='" + model.Remark + "', ");
            builder.Append(" UserCode='" + model.UserCode + "', ");
            builder.Append(" RecordDate='" + model.RecordDate + "' ");
            builder.Append(" where TypeCode='" + model.TypeCode + "' ");
            return(publicDbOpClass.ExecSqlString(builder.ToString()));
        }
コード例 #4
0
        public int Add(ptOfficeResClass model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into OA_OfficeRes_Class(");
            builder.Append("TypeCode,TypeName,Remark,IsValid,UserCode,RecordDate,i_ChildNum");
            builder.Append(")");
            builder.Append(" values (");
            builder.Append("'" + model.TypeCode + "',");
            builder.Append("'" + model.TypeName + "',");
            builder.Append("'" + model.Remark + "',");
            builder.Append("'" + model.IsValid + "',");
            builder.Append("'" + model.UserCode + "',");
            builder.Append("'" + model.RecordDate + "',");
            builder.Append(model.i_ChildNum);
            builder.Append(")");
            builder.Append(" update OA_OfficeRes_Class set i_ChildNum=i_ChildNum+1 where TypeCode=left('" + model.TypeCode + "',len('" + model.TypeCode + "')-4) ");
            return(publicDbOpClass.ExecSqlString(builder.ToString()));
        }
コード例 #5
0
    private ptOfficeResClass GetData()
    {
        ptOfficeResClass ptOfficeResClass = new ptOfficeResClass();

        ptOfficeResClass.i_ChildNum = 0;
        if (this.OperateType == "upd")
        {
            ptOfficeResClass.TypeCode = this.LibraryCode;
        }
        else
        {
            if (this.LibraryCode == "")
            {
                ptOfficeResClass.TypeCode = OfficeCommonClass.GetNewSameLevelCode("OA_OfficeRes_Class", "TypeCode", "", 4);
            }
            else
            {
                string strWhere = string.Concat(new object[]
                {
                    " TypeCode like ('",
                    this.LibraryCode,
                    "%') and len(TypeCode)>len('",
                    this.LibraryCode,
                    "') and left(TypeCode,",
                    this.LibraryCode.Length,
                    ")='",
                    this.LibraryCode,
                    "'"
                });
                ptOfficeResClass.TypeCode = OfficeCommonClass.GetNewLowerLevelCode("OA_OfficeRes_Class", "TypeCode", this.LibraryCode, strWhere, this.LibraryCode.Length + 4);
            }
        }
        ptOfficeResClass.IsValid    = "1";
        ptOfficeResClass.RecordDate = DateTime.Now;
        ptOfficeResClass.Remark     = this.txtRemark.Text.Trim();
        ptOfficeResClass.TypeName   = this.txtBookLibraryName.Text.Trim();
        ptOfficeResClass.UserCode   = base.UserCode;
        return(ptOfficeResClass);
    }