예제 #1
0
            private CMTDetails GetResultSetToMTDtls(DataRow dr)
            {
                CMTDetails oDetails = new CMTDetails();

                oDetails.MTDtls_OID        = dr["MTDtls_OID"].ToString();
                oDetails.MTDtls_Branch     = dr["MTDtls_Branch"].ToString();
                oDetails.MTDtls_MstrOID    = dr["MTDtls_MstrOID"].ToString();
                oDetails.MTDtls_ItemOID    = dr["MTDtls_ItemOID"].ToString();
                oDetails.MTDtls_IssQty     = float.Parse(dr["MTDtls_IssQty"].ToString());
                oDetails.MTDtls_IssUOMOID  = dr["MTDtls_IssUOMOID"].ToString();
                oDetails.MTDtls_SBranOID   = dr["MTDtls_SBranOID"].ToString();
                oDetails.MTDtls_SrcLocOID  = dr["MTDtls_SrcLocOID"].ToString();
                oDetails.MTDtls_SrcInvTyp  = int.Parse(dr["MTDtls_SrcInvTyp"].ToString());
                oDetails.MTDtls_DBranOID   = dr["MTDtls_DBranOID"].ToString();
                oDetails.MTDtls_DestLocOID = dr["MTDtls_DestLocOID"].ToString();
                oDetails.MTDtls_DesInvtyp  = int.Parse(dr["MTDtls_DesInvtyp"].ToString());
                oDetails.MTDtls_RQty       = float.Parse(dr["MTDtls_RQty"].ToString());
                oDetails.MTDtls_RUOMOID    = dr["MTDtls_RUOMOID"].ToString();
                oDetails.MTDtls_Status     = int.Parse(dr["MTDtls_Status"].ToString());

                return(oDetails);
            }
예제 #2
0
        private CMTMaster GetToBSavedData()
        {
            oMTFinalQtyDic.Clear();

            CMTMaster oMTMaster = new CMTMaster();

            oMTMaster.MTMstr_OID    = txtSelectedMTOID.Text.Trim();
            oMTMaster.MTMstr_DOrder = txtDeliverOrder.Text.Trim();
            oMTMaster.MTMstr_Branch = currentBranch.CompBrn_Code;
            oMTMaster.MTMstr_Date   = dtpMTDate.Value.Date;

            oMTMaster.Creator      = currentUser.User_OID;
            oMTMaster.CreationDate = DateTime.Now.Date;
            oMTMaster.UpdateBy     = currentUser.User_OID;
            oMTMaster.UpdateDate   = DateTime.Now.Date;
            oMTMaster.IsActive     = "Y";
            oMTMaster.Remarks      = "";

            for (int i = 0; i < dgItemList.Rows.Count - 1; i++)
            {
                if (ValidateListItem(dgItemList.Rows[i]))
                {
                    CMTDetails oMTDetails = new CMTDetails();

                    oMTDetails.MTDtls_Branch  = currentBranch.CompBrn_Code;
                    oMTDetails.MTDtls_ItemOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colItem"]).Value.ToString();
                    if (dgItemList.Rows[i].Cells["colIssueqty"].Value != null)
                    {
                        oMTDetails.MTDtls_IssQty = float.Parse(((DataGridViewTextBoxCell)dgItemList.Rows[i].Cells["colIssueqty"]).Value.ToString());
                    }
                    if (dgItemList.Rows[i].Cells["colIssueUOM"].Value != null)
                    {
                        oMTDetails.MTDtls_IssUOMOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colIssueUOM"]).Value.ToString();
                    }

                    if (dgItemList.Rows[i].Cells["colSrcBranch"].Value != null)
                    {
                        oMTDetails.MTDtls_SBranOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colSrcBranch"]).Value.ToString();
                    }

                    if (dgItemList.Rows[i].Cells["colSourceLoc"].Value != null)
                    {
                        oMTDetails.MTDtls_SrcLocOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colSourceLoc"]).Value.ToString();
                    }

                    if (dgItemList.Rows[i].Cells["colSrcInvType"].Value != null)
                    {
                        oMTDetails.MTDtls_SrcInvTyp = Convert.ToInt32(Enum.Parse(typeof(EInvType), ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colSrcInvType"]).Value.ToString()));
                    }
                    if (dgItemList.Rows[i].Cells["colDesBranch"].Value != null)
                    {
                        oMTDetails.MTDtls_DBranOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colDesBranch"]).Value.ToString();
                    }

                    if (dgItemList.Rows[i].Cells["colDesLocation"].Value != null)
                    {
                        oMTDetails.MTDtls_DestLocOID = ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colDesLocation"]).Value.ToString();
                    }
                    if (dgItemList.Rows[i].Cells["colDesInvType"].Value != null)
                    {
                        oMTDetails.MTDtls_DesInvtyp = Convert.ToInt32(Enum.Parse(typeof(EInvType), ((DataGridViewComboBoxCell)dgItemList.Rows[i].Cells["colDesInvType"]).Value.ToString()));
                    }

                    oMTMaster.MTMstr_DetailsList.Add(oMTDetails);

                    //update inmv
                    if (IsUpdateMode)
                    {
                        CMTDetails oInvMTDetails = new CMTDetails();

                        oInvMTDetails.MTDtls_ItemOID   = oMTDetails.MTDtls_ItemOID;
                        oInvMTDetails.MTDtls_Branch    = oMTDetails.MTDtls_Branch;
                        oInvMTDetails.MTDtls_SBranOID  = oMTDetails.MTDtls_SBranOID;
                        oInvMTDetails.MTDtls_SrcLocOID = oMTDetails.MTDtls_SrcLocOID;
                        oInvMTDetails.MTDtls_SrcInvTyp = oMTDetails.MTDtls_SrcInvTyp;

                        oInvMTDetails.MTDtls_DBranOID   = oMTDetails.MTDtls_DBranOID;
                        oInvMTDetails.MTDtls_DestLocOID = oMTDetails.MTDtls_DestLocOID;
                        oInvMTDetails.MTDtls_DesInvtyp  = oMTDetails.MTDtls_DesInvtyp;

                        if (dgItemList.Rows[i].Cells["colFinalQty"].Value != null)
                        {
                            oInvMTDetails.MTDtls_IssQty = float.Parse(((DataGridViewTextBoxCell)dgItemList.Rows[i].Cells["colFinalQty"]).Value.ToString());
                        }
                        else
                        {
                            oInvMTDetails.MTDtls_IssQty = 0.00f;
                        }
                        oMTFinalQtyDic.Add(oInvMTDetails.MTDtls_ItemOID, oInvMTDetails);
                    }
                }
                else
                {
                    return(null);
                }
            }

            //for update inv
            foreach (string obj in oMTExistingQtyDic.Keys)
            {
                if (!oMTFinalQtyDic.ContainsKey(obj))
                {
                    CMTDetails oInvMTDetails = new CMTDetails();

                    oInvMTDetails.MTDtls_ItemOID   = oMTExistingQtyDic[obj].MTDtls_ItemOID;
                    oInvMTDetails.MTDtls_Branch    = oMTExistingQtyDic[obj].MTDtls_Branch;
                    oInvMTDetails.MTDtls_SBranOID  = oMTExistingQtyDic[obj].MTDtls_SBranOID;
                    oInvMTDetails.MTDtls_SrcLocOID = oMTExistingQtyDic[obj].MTDtls_SrcLocOID;
                    oInvMTDetails.MTDtls_SrcInvTyp = oMTExistingQtyDic[obj].MTDtls_SrcInvTyp;

                    oInvMTDetails.MTDtls_DBranOID   = oMTExistingQtyDic[obj].MTDtls_DBranOID;
                    oInvMTDetails.MTDtls_DestLocOID = oMTExistingQtyDic[obj].MTDtls_DestLocOID;
                    oInvMTDetails.MTDtls_DesInvtyp  = oMTExistingQtyDic[obj].MTDtls_DesInvtyp;

                    oInvMTDetails.MTDtls_IssQty = oMTExistingQtyDic[obj].MTDtls_IssQty * -1;

                    oMTFinalQtyDic.Add(obj, oInvMTDetails);
                }
            }
            return(oMTMaster);
        }