Exemple #1
0
        public static A2ZDEPARTMENTDTO GetInformation(Int16 Deptcode)
        {
            var prm = new object[1];

            prm[0] = Deptcode;



            DataTable dt = BLL.CommonManager.Instance.GetDataTableBySpWithParams("Sp_HKGetInfoDepartment", prm, "A2ZHKMCUS");



            //DataTable dt = BLL.CommonManager.Instance.GetDataTableByQuery("SELECT * FROM A2ZDEPARTMENT WHERE DepartmentCode = " + Deptcode, "A2ZHKMCUS");


            var p = new A2ZDEPARTMENTDTO();

            if (dt.Rows.Count > 0)
            {
                p.DepartmentCode = Converter.GetSmallInteger(dt.Rows[0]["DepartmentCode"]);
                p.DepartmentName = Converter.GetString(dt.Rows[0]["DepartmentName"]);
                return(p);
            }
            p.DepartmentCode = 0;

            return(p);
        }
Exemple #2
0
        public static int UpdateInformation(A2ZDEPARTMENTDTO dto)
        {
            dto.DepartmentName = (dto.DepartmentName != null) ? dto.DepartmentName.Trim().Replace("'", "''") : "";
            int    rowEffect = 0;
            string strQuery  = "UPDATE A2ZDEPARTMENT set DepartmentCode='" + dto.DepartmentCode + "',DepartmentName='" + dto.DepartmentName + "' where DepartmentCode='" + dto.DepartmentCode + "'";

            rowEffect = Converter.GetInteger(BLL.CommonManager.Instance.ExecuteNonQuery(strQuery, "A2ZHKMCUS"));
            if (rowEffect == 0)
            {
                return(0);
            }
            else
            {
                return(1);
            }
        }
Exemple #3
0
        public static int InsertInformation(A2ZDEPARTMENTDTO dto)
        {
            dto.DepartmentName = (dto.DepartmentName != null) ? dto.DepartmentName.Trim().Replace("'", "''") : "";
            int    rowEffect = 0;
            string strQuery  = @"INSERT into A2ZDEPARTMENT(DepartmentCode,DepartmentName)values('" + dto.DepartmentCode + "','" + dto.DepartmentName + "')";

            rowEffect = Converter.GetInteger(BLL.CommonManager.Instance.ExecuteNonQuery(strQuery, "A2ZHKMCUS"));

            if (rowEffect == 0)
            {
                return(0);
            }
            else
            {
                return(1);
            }
        }