protected void btnAdd_Click(object sender, EventArgs e)
    {
        OAOfficeResDepartmentApplication data = this.GetData();

        if (this.OperateType == "add")
        {
            int num = this.amAction.Add(data);
            if (num > 0)
            {
                this.Page.RegisterStartupScript("", "<script>alert('添加成功!');returnValue=true;window.close();</script>");
            }
            else
            {
                this.Page.RegisterStartupScript("", "<script>alert('没有相关数据可添加!');</script>");
            }
        }
        if (this.OperateType == "upd")
        {
            int num = this.amAction.Update(data);
            if (num > 0)
            {
                this.Page.RegisterStartupScript("", "<script>alert('修改成功!');returnValue=true;window.close();</script>");
                return;
            }
            this.Page.RegisterStartupScript("", "<script>alert('没有相关数据可更新!');</script>");
        }
    }
    private OAOfficeResDepartmentApplication GetData()
    {
        OAOfficeResDepartmentApplication oAOfficeResDepartmentApplication = new OAOfficeResDepartmentApplication();

        oAOfficeResDepartmentApplication.ACRecordID = Guid.Empty;
        oAOfficeResDepartmentApplication.ApplyDate  = ((this.txtApplyDate.Text.Trim() == "") ? DateTime.Now : Convert.ToDateTime(this.txtApplyDate.Text.Trim()));
        string personInfo = OAOfficeCommonClas.GetPersonInfo(base.UserCode, "i_bmdm");

        oAOfficeResDepartmentApplication.ApplyDepartment = ((personInfo == "") ? 0 : int.Parse(personInfo));
        oAOfficeResDepartmentApplication.ApplyMan        = base.UserCode;
        oAOfficeResDepartmentApplication.AuditState      = -1;
        oAOfficeResDepartmentApplication.CorpCode        = this.Session["CorpCode"].ToString();
        if (this.OperateType == "upd")
        {
            oAOfficeResDepartmentApplication.DARecordID = this.InStorageID;
        }
        else
        {
            oAOfficeResDepartmentApplication.DARecordID = Guid.NewGuid();
        }
        oAOfficeResDepartmentApplication.IsAbove    = "0";
        oAOfficeResDepartmentApplication.IsComplete = "0";
        oAOfficeResDepartmentApplication.IsSubmit   = "0";
        oAOfficeResDepartmentApplication.RecordDate = DateTime.Now;
        oAOfficeResDepartmentApplication.UserCode   = base.UserCode;
        oAOfficeResDepartmentApplication.Remark     = this.txtRemark.Text.Trim();
        return(oAOfficeResDepartmentApplication);
    }
Beispiel #3
0
        public int Update(OAOfficeResDepartmentApplication model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update OA_OfficeRes_DepartmentApplication set ");
            builder.Append("ApplyDate='" + model.ApplyDate + "',");
            builder.Append("Remark='" + model.Remark + "'");
            builder.Append("where DARecordID='" + model.DARecordID + "'");
            return(publicDbOpClass.ExecSqlString(builder.ToString()));
        }
Beispiel #4
0
        public OAOfficeResDepartmentApplication GetModel(Guid DARecordID)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" select DARecordID,AuditState,CorpCode,ApplyDate,ApplyDepartment,ApplyMan,IsSubmit,IsComplete,UserCode,RecordDate,IsAbove,ACRecordID ");
            builder.Append(" from OA_OfficeRes_DepartmentApplication ");
            builder.Append(" where DARecordID='" + DARecordID + "'");
            OAOfficeResDepartmentApplication application = new OAOfficeResDepartmentApplication();
            DataSet set = publicDbOpClass.DataSetQuary(builder.ToString());

            if (set.Tables[0].Rows.Count <= 0)
            {
                return(null);
            }
            if (set.Tables[0].Rows[0]["DARecordID"].ToString() != "")
            {
                application.DARecordID = new Guid(set.Tables[0].Rows[0]["DARecordID"].ToString());
            }
            if (set.Tables[0].Rows[0]["AuditState"].ToString() != "")
            {
                application.AuditState = int.Parse(set.Tables[0].Rows[0]["AuditState"].ToString());
            }
            application.CorpCode = set.Tables[0].Rows[0]["CorpCode"].ToString();
            if (set.Tables[0].Rows[0]["ApplyDate"].ToString() != "")
            {
                application.ApplyDate = DateTime.Parse(set.Tables[0].Rows[0]["ApplyDate"].ToString());
            }
            if (set.Tables[0].Rows[0]["ApplyDepartment"].ToString() != "")
            {
                application.ApplyDepartment = int.Parse(set.Tables[0].Rows[0]["ApplyDepartment"].ToString());
            }
            application.ApplyMan   = set.Tables[0].Rows[0]["ApplyMan"].ToString();
            application.IsSubmit   = set.Tables[0].Rows[0]["IsSubmit"].ToString();
            application.IsComplete = set.Tables[0].Rows[0]["IsComplete"].ToString();
            application.UserCode   = set.Tables[0].Rows[0]["UserCode"].ToString();
            application.Remark     = set.Tables[0].Rows[0]["Remark"].ToString();
            if (set.Tables[0].Rows[0]["RecordDate"].ToString() != "")
            {
                application.RecordDate = DateTime.Parse(set.Tables[0].Rows[0]["RecordDate"].ToString());
            }
            application.IsAbove = set.Tables[0].Rows[0]["IsAbove"].ToString();
            if (set.Tables[0].Rows[0]["ACRecordID"].ToString() != "")
            {
                application.ACRecordID = new Guid(set.Tables[0].Rows[0]["ACRecordID"].ToString());
            }
            return(application);
        }
Beispiel #5
0
        public int Add(OAOfficeResDepartmentApplication model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into OA_OfficeRes_DepartmentApplication(");
            builder.Append("DARecordID,AuditState,CorpCode,ApplyDate,ApplyDepartment,ApplyMan,IsSubmit,IsComplete,UserCode,RecordDate,IsAbove,ACRecordID,Remark");
            builder.Append(")");
            builder.Append(" values (");
            builder.Append("'" + model.DARecordID + "',");
            builder.Append(model.AuditState + ",");
            builder.Append("'" + model.CorpCode + "',");
            builder.Append("'" + model.ApplyDate + "',");
            builder.Append(model.ApplyDepartment + ",");
            builder.Append("'" + model.ApplyMan + "',");
            builder.Append("'" + model.IsSubmit + "',");
            builder.Append("'" + model.IsComplete + "',");
            builder.Append("'" + model.UserCode + "',");
            builder.Append("'" + model.RecordDate + "',");
            builder.Append("'" + model.IsAbove + "',");
            builder.Append("'" + model.ACRecordID + "',");
            builder.Append("'" + model.Remark + "'");
            builder.Append(")");
            return(publicDbOpClass.ExecSqlString(builder.ToString()));
        }