Exemplo n.º 1
0
 private POEditData GetData()
 {
     POEditData data = new POEditData();
     data.PECODE = this.txtPECode.Text.Trim();
     data.DATEFROM = this.ctlDateFrom.DateValue;
     data.DATETO = this.ctlDateTo.DateValue;
     data.PODATEFROM = this.ctlPODateFrom.DateValue;
     data.PODATETO = this.ctlPODateTo.DateValue;
     data.POCODE = this.txtPOCode.Text.Trim();
     data.STATUSFROM = this.cmbStatusFrom.SelectedItem.Value;
     data.STATUSTO = this.cmbStatusTo.SelectedItem.Value;
     data.SUPPLIER = this.cmbSupplier.SelectedItem.Value;
     return data;
 }
Exemplo n.º 2
0
        public bool UpdateDataPOEdit(string userID, POEditData data)
        {
            bool ret = true;

                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj2.OnDB = false;
                    DALObj2.GetDataByLOID(data.LOID, obj.zTrans);

                    DALObj2.ACTIVE = data.ACTIVE;
                    DALObj2.APPROVEDATE = data.APPROVEDATE;
                    DALObj2.APPROVER = data.APPROVER;
                    DALObj2.POEDITDATE = data.POEDITDATE;
                    DALObj2.CODE = data.CODE;
                    DALObj2.PONEW = data.PONEW;
                    DALObj2.POOLD = data.POOLD;
                    DALObj2.REASON = data.REASON;
                    DALObj2.REMARK = data.REMARK;
                    DALObj2.STATUS = data.STATUS;
                    DALObj2.TYPE = data.TYPE;


                    if (DALObj2.OnDB)
                        ret = DALObj2.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = DALObj2.InsertCurrentData(userID, obj.zTrans);

                    _LOIDEDIT = DALObj2.LOID;
                    if (!ret)
                    {
                        throw new ApplicationException(DALObj.ErrorMessage);
                    }

                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
                return ret;
        }
Exemplo n.º 3
0
        //public DataTable GetPOEditList(POEditData data)
        //{
        //    string whereString = "";

        //    if (data.PECODE.Trim() != "")
        //        whereString += (whereString == "" ? "" : "AND ") + "UPPER(PECODE) = '" + OracleDB.QRText(data.PECODE.Trim()).ToUpper() + "' ";
        //    if (data.POCODE.Trim() != "")
        //        whereString += (whereString == "" ? "" : "AND ") + "UPPER(POCODE) = '" + OracleDB.QRText(data.POCODE.Trim()).ToUpper() + "' ";
        //    if (data.DATEFROM.Year != 1)
        //        whereString += (whereString == "" ? "" : "AND ") + "POEDITDATE >= " + OracleDB.QRDate(data.DATEFROM) + " ";
        //    if (data.DATETO.Year != 1)
        //        whereString += (whereString == "" ? "" : "AND ") + "POEDITDATE <= " + OracleDB.QRDate(data.DATETO) + " ";
        //    if (data.PODATEFROM.Year != 1)
        //        whereString += (whereString == "" ? "" : "AND ") + "ORDERDATE >= " + OracleDB.QRDate(data.PODATEFROM) + " ";
        //    if (data.PODATETO.Year != 1)
        //        whereString += (whereString == "" ? "" : "AND ") + "ORDERDATE <= " + OracleDB.QRDate(data.PODATETO) + " ";
        //    if (data.SUPPLIER != "0")
        //        whereString += (whereString == "" ? "" : "AND ") + "SUPPLIER = " + data.SUPPLIER.ToString() + " ";
        //    if (data.STATUSFROM.Trim() != "")
        //        whereString += (whereString == "" ? "" : "AND ") + "RANK >= '" + OracleDB.QRText(data.STATUSFROM.Trim()) + "' ";
        //    if (data.STATUSTO.Trim() != "")
        //        whereString += (whereString == "" ? "" : "AND ") + "RANK <= '" + OracleDB.QRText(data.STATUSTO.Trim()) + "' ";

        //    string sql = "SELECT * FROM (SELECT  ROWNUM NO, PE.LOID PELOID, PE.CODE PECODE, PE.POEDITDATE, PE.REASON, PO.LOID POLOID, PO.CODE POCODE, PO.ORDERDATE, ";
        //    sql += "CASE PE.STATUS WHEN '" + Constz.Requisition.Status.Waiting.Code + "' THEN '" + Constz.Requisition.Status.Waiting.Name + "' ";
        //    sql += "WHEN '" + Constz.Requisition.Status.Approved.Code + "' THEN '" + Constz.Requisition.Status.Approved.Name + "' ";
        //    sql += "WHEN '" + Constz.Requisition.Status.Void.Code + "' THEN '" + Constz.Requisition.Status.Void.Name + "' ";
        //    sql += "ELSE '' END AS STATUSNAME, ";
        //    sql += "CASE PE.STATUS WHEN '" + Constz.Requisition.Status.Waiting.Code + "' THEN '" + Constz.Requisition.Status.Waiting.Rank + "' ";
        //    sql += "WHEN '" + Constz.Requisition.Status.Approved.Code + "' THEN '" + Constz.Requisition.Status.Approved.Rank + "' ";
        //    sql += "WHEN '" + Constz.Requisition.Status.Void.Code + "' THEN '" + Constz.Requisition.Status.Void.Rank + "' ";
        //    sql += "ELSE '' END AS RANK, PO.SUPPLIER,S.SUPPLIERNAME, PE.PONEW, PE.POOLD ";
        //    sql += "FROM POEDIT PE INNER JOIN PDORDER PO ON PE.POOLD = PO.LOID ";
        //    sql += "INNER JOIN SUPPLIER S ON PO.SUPPLIER = S.LOID) ";
        //    sql += (whereString == "" ? "" : "WHERE " + whereString);
        //    sql += "ORDER BY PECODE ";

        //    DataTable dt = OracleDB.ExecListCmd(sql);
        //    return dt;
        //}

        public DataTable GetPOEditList(POEditData data)
        {
            DataTable dt = DALObj2.GetPOEditList(data);
            int i = 1;
            foreach (DataRow dRow in dt.Rows)
            {
                dRow["NO"] = i;
                i += 1;
            }
            return dt;
        }
Exemplo n.º 4
0
 public POEditData GetDataEdit(double loid)
 {
     POEditData data = new POEditData();
     if (DALObj2.GetDataByLOID(loid, null))
     {
         data.LOID = DALObj2.LOID;
         data.CODE = DALObj2.CODE;
         data.ACTIVE = DALObj2.ACTIVE;
         data.APPROVEDATE = DALObj2.APPROVEDATE;
         data.APPROVER = DALObj2.APPROVER;
         data.POEDITDATE = DALObj2.POEDITDATE;
         data.PONEW = DALObj2.PONEW;
         data.POOLD = DALObj2.POOLD;
         data.REASON = DALObj2.REASON;
         data.REMARK = DALObj2.REMARK;
         data.STATUS = DALObj2.STATUS;
      
     }
     return data;
 }
Exemplo n.º 5
0
        public DataTable GetPOEditList(POEditData data)
        {
            string whereString = "";

            if (data.PECODE.Trim() != "")
                whereString += (whereString == "" ? "" : "AND ") + "UPPER(PECODE) = '" + OracleDB.QRText(data.PECODE.Trim()).ToUpper() + "' ";
            if (data.POCODE.Trim() != "")
                whereString += (whereString == "" ? "" : "AND ") + "UPPER(POCODE) = '" + OracleDB.QRText(data.POCODE.Trim()).ToUpper() + "' ";
            if (data.DATEFROM.Year != 1)
                whereString += (whereString == "" ? "" : "AND ") + "POEDITDATE >= " + OracleDB.QRDate(data.DATEFROM) + " ";
            if (data.DATETO.Year != 1)
                whereString += (whereString == "" ? "" : "AND ") + "POEDITDATE <= " + OracleDB.QRDate(data.DATETO) + " ";
            if (data.PODATEFROM.Year != 1)
                whereString += (whereString == "" ? "" : "AND ") + "ORDERDATE >= " + OracleDB.QRDate(data.PODATEFROM) + " ";
            if (data.PODATETO.Year != 1)
                whereString += (whereString == "" ? "" : "AND ") + "ORDERDATE <= " + OracleDB.QRDate(data.PODATETO) + " ";
            if (data.SUPPLIER != "0")
                whereString += (whereString == "" ? "" : "AND ") + "SUPPLIER = " + data.SUPPLIER.ToString() + " ";
            if (data.STATUSFROM.Trim() != "")
                whereString += (whereString == "" ? "" : "AND ") + "RANK >= '" + OracleDB.QRText(data.STATUSFROM.Trim()) + "' ";
            if (data.STATUSTO.Trim() != "")
                whereString += (whereString == "" ? "" : "AND ") + "RANK <= '" + OracleDB.QRText(data.STATUSTO.Trim()) + "' ";

            string sql = "SELECT * FROM (SELECT  ROWNUM NO, PE.LOID PELOID, PE.CODE PECODE, PE.POEDITDATE, PE.REASON, PO.LOID POLOID, PO.CODE POCODE, PO.ORDERDATE, ";
            sql += "CASE PE.STATUS WHEN '" + Constz.Requisition.Status.Waiting.Code + "' THEN '" + Constz.Requisition.Status.Waiting.Name + "' ";
            sql += "WHEN '" + Constz.Requisition.Status.Approved.Code + "' THEN '" + Constz.Requisition.Status.Approved.Name + "' ";
            sql += "WHEN '" + Constz.Requisition.Status.Void.Code + "' THEN '" + Constz.Requisition.Status.Void.Name + "' ";
            sql += "ELSE '' END AS STATUSNAME, ";
            sql += "CASE PE.STATUS WHEN '" + Constz.Requisition.Status.Waiting.Code + "' THEN '" + Constz.Requisition.Status.Waiting.Rank + "' ";
            sql += "WHEN '" + Constz.Requisition.Status.Approved.Code + "' THEN '" + Constz.Requisition.Status.Approved.Rank + "' ";
            sql += "WHEN '" + Constz.Requisition.Status.Void.Code + "' THEN '" + Constz.Requisition.Status.Void.Rank + "' ";
            sql += "ELSE '' END AS RANK, PO.SUPPLIER,S.SUPPLIERNAME, PE.PONEW, PE.POOLD ";
            sql += "FROM POEDIT PE INNER JOIN PDORDER PO ON PE.POOLD = PO.LOID ";
            sql += "INNER JOIN SUPPLIER S ON PO.SUPPLIER = S.LOID) ";
            sql += (whereString == "" ? "" : "WHERE " + whereString);
            sql += "ORDER BY PECODE DESC";

            DataTable dt = OracleDB.ExecListCmd(sql);
            return dt;
        }
Exemplo n.º 6
0
 private POEditData GetRecentDataEdit()
 {
     POEditData data = new POEditData();
     data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
     data.CODE = this.txtEditCode.Text.Trim();
     data.STATUS = Constz.Requisition.Status.Approved.Code;
     data.ACTIVE = Constz.ActiveStatus.Active;
     data.POEDITDATE = this.ctlOrderDate.DateValue;
     data.PONEW = Convert.ToDouble(this.txtNewLoid.Text == "" ? "0" : this.txtNewLoid.Text);
     data.POOLD = Convert.ToDouble(this.txtOldLoid.Text == "" ? "0" : this.txtOldLoid.Text);
     data.REASON = this.txtReason.Text.Trim();
     data.REMARK = this.txtRemark.Text.Trim();
     data.APPROVEDATE = DateTime.Now.Date;
     data.APPROVER = Authz.CurrentUserInfo.UserID;
     data.TYPE = "1";
     return data;
 }
Exemplo n.º 7
0
 private POEditData GetDataEdit()
 {
     POEditData data = new POEditData();
     data.LOID = Convert.ToDouble(this.txtLOID.Text == "" ? "0" : this.txtLOID.Text);
     data.CODE = this.txtEditCode.Text.Trim();
     data.STATUS = this.txtStatus.Text.Trim();
     data.ACTIVE = Constz.ActiveStatus.Active;
     data.POEDITDATE = this.ctlOrderDate.DateValue;
     data.PONEW = Convert.ToDouble(this.txtNewLoid.Text == "" ? "0" : this.txtNewLoid.Text);
     data.POOLD = Convert.ToDouble(this.txtOldLoid.Text == "" ? "0" : this.txtOldLoid.Text);
     data.REASON = this.txtReason.Text.Trim();
     data.REMARK = this.txtRemark.Text.Trim();
     data.TYPE = "1";
     return data;
 }
Exemplo n.º 8
0
    private void SetDataEdit(POEditData data)
    {
        this.txtLOID.Text = data.LOID.ToString();
        this.ctlOrderDate.DateValue = data.POEDITDATE;
        this.txtEditCode.Text = data.CODE;
        this.txtNewLoid.Text = data.PONEW.ToString();
        this.txtOldLoid.Text = data.POOLD.ToString();
        this.txtReason.Text = data.REASON;
        this.txtRemark.Text = data.REMARK;
        this.txtStatus.Text = data.STATUS;
        this.txtStatusName.Text = (data.STATUS == Constz.Requisition.Status.Approved.Code ? Constz.Requisition.Status.Approved.Name : (data.STATUS == Constz.Requisition.Status.Void.Code ? Constz.Requisition.Status.Void.Name : Constz.Requisition.Status.Waiting.Name));

        if (data.STATUS == Constz.Requisition.Status.Approved.Code || data.STATUS == Constz.Requisition.Status.Void.Code)
        {
            this.ctlToolbar.BtnSaveShow = false;
            this.ctlToolbar.BtnSubmitShow = false;
        }

    }