Example #1
0
        public string GetNextRefNo(string exAttribute)
        {
            string InputValue = CXmlPara.CreatePara(new CPara[] {
                new CPara("RefDate", DateTime.Now.ToString("yyyy-MM-dd"))
            },
                                                    exAttribute
                                                    );
            CRefNo refno = core_service.GetNextRefNo(InputValue);

            return(CJson.SerializeObject(refno));
        }
Example #2
0
        public string GetNextRefNo(string pRefType)
        {
            pRefType = pRefType == "" ? "4" : pRefType;
            string InputValue = CXmlPara.CreatePara(new CPara[] {
                new CPara("RefDate", DateTime.Now.ToString("yyyy-MM-dd")),
                new CPara("RefType", pRefType)
            },
                                                    ""
                                                    );
            CRefNo refno = core_service.GetNextRefNo(InputValue);

            return(CJson.SerializeObject(refno));
        }
Example #3
0
        public bool UpdateTransaction()
        {
            // == Kiem tra RefNo truoc neu refno moi
            if (isNew)
            {
                string inputValue    = string.Format("<InputValue RefType='28' RefDate='{0}'/>", DateTime.Now.ToString("yyyy-MM-dd"));
                CRefNo objRefNo      = CServiceReference.CoreService.GetNextRefNo(inputValue);
                int    compareResult = string.Compare(objRefNo.RefNo, txtRefNo.Text, true);
                if (compareResult > 0)
                {
                    DialogResult dr = ShowQuestion("Số công văn đã thay đổi, số mới là:" + objRefNo.RefNo + ". Bạn có muốn in với số mới không?");
                    if (dr == DialogResult.Yes)
                    {
                        txtRefNo.Text = objRefNo.RefNo;
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            // CurrentTransaction.OldRefNo = txtOldRefNo.Text;
            //CurrentTransaction.AssetType = int.Parse(txtAssetType.SelectedValue.ToString());
            CurrentTransaction.RefDate = GetRefDateTime();
            //CurrentTransaction.RefNo = txtRefNo.Text;// CurrentTransaction.RegisTransRefNo;
            //CurrentTransaction.RefType = 21;
            //CurrentTransaction.Type = int.Parse(txtVoucherActionType.SelectedValue.ToString());
            //CurrentTransaction.ObjectID = int.Parse(txtDirection.SelectedValue.ToString());
            CurrentTransaction.Note         = txtReason.Text;
            CurrentTransaction.SendGCNEmail = txtEmail.Text;
            if (txtKHTX.SelectedItem != null)
            {
                CurrentTransaction.WarranterID      = (int)txtKHTX.SelectedItem.Value;
                CurrentTransaction.WarranterName    = txtKHTX.Text;
                CurrentTransaction.WarranterAddress = txtAddress.Text;
                //CurrentTransaction.ObjectEmail = txtObjectEmail.Text;
            }
            else
            {
                CurrentTransaction.WarranterID      = 0;
                CurrentTransaction.WarranterName    = txtKHTX.Text;
                CurrentTransaction.WarranterAddress = txtAddress.Text;
                //CurrentTransaction.ObjectEmail = txtObjectEmail.Text;
            }

            //CurrentTransaction.IsSendMail = chkSendMail.Checked;
            //CurrentTransaction.IsSendMailKH = chkSendEmailKH.Checked;
            //CurrentTransaction.WarranterEmail = txtWarranterEmail.Text;


            string       requestparams = CurrentTransaction.GetRequestParams("Function='Transaction_Asset' Action='UPDATE' Context='TOOL'");
            CCoreService service       = new CCoreService();

            requestparams = CXML.AddAuthenticate(requestparams);
            string messageCSV = service.ExecuteAction(CSession.CLIENT_KEY, CXML.HtmlEnCode(requestparams));
            IList <FWS.TTDKGDTS.ImportTool.BusinessObject.CApplicationMessage> message = CObjectMapper.FromCSV <FWS.TTDKGDTS.ImportTool.BusinessObject.CApplicationMessage>(messageCSV, 1);

            if (message[0].Result == null || message[0].Result.ToString().Equals("") || message[0].Result.ToString().Equals("0"))
            {
                Message = message[0].Description;
                //MessageBox.Show(message[0].Description);
                return(false);
            }

            return(true);
        }
Example #4
0
        public void InitControl(string RegisTransRefNo)
        {
            //Lay du lieu tu so don dang ky
            InitComboboxData();
            //InitGridColumn();
            CCoreService service    = new CCoreService();
            string       inputValue = string.Format("<RequestParams Function='GetTransaction_Asset' RefType='28' RegisTransRefNo='{0}' Context=\"{1}\" />", RegisTransRefNo, "TOOL_PRINT");

            //inputValue = string.Format("<RequestParams Function='GetTransaction_Asset' RefType='21' RefNo='{0}' />", RegisTransRefNo);
            //inputValue = inputValue + string.Format("<RequestParams Function='GetTransaction_Asset' RefType='21' RefNo='{0}' Context='AssetsList'/>", RegisTransRefNo);
            inputValue = inputValue + string.Format("<RequestParams Function='GetTransaction_Asset' RefType='21' RefNo='{0}' Context='WarranterList'/>", RegisTransRefNo);
            //inputValue = inputValue + string.Format("<RequestParams Function='GetTransaction_Asset' RefType='21' RefNo='{0}' Context='AssetOwnerList'/>", RegisTransRefNo);
            inputValue = inputValue + "<RequestParams Function='FilterParaData' ListFunction='VoucherActionType'/>";
            string datacsv             = service.GetContextData(CSession.CLIENT_KEY, inputValue);
            IList <CTransaction> trans = CObjectMapper.FromCSV <CTransaction>(datacsv, 1);

            List <Person> waranter = CObjectMapper.FromCSV <Person>(datacsv, 2);

            if (waranter == null)
            {
                waranter = new List <Person>();
            }

            IList <CParaData> actionlist = CObjectMapper.FromCSV <CParaData>(datacsv, 3);

            gridAcctionType = new List <CParaData>();
            gridAcctionType.Add(new CParaData()
            {
                Name = "...", ID = 0, Value = "0"
            });
            foreach (CParaData para in actionlist)
            {
                if (para.ID == 93 || para.ID == 95)
                {
                    gridAcctionType.Add(para);
                }
            }

            if (trans != null && trans.Count > 0)
            {
                //InitAssetOwnnerGridColumn();
                //InitWarranterGridColumn();
                //Neu RefNo = Empty thi lay RefNo moi tu va enable textbox cho phep edit RefNo
                //Khoa lai chuc nang Edit RefNo
                if (string.IsNullOrEmpty(trans[0].RefNo))
                {
                    inputValue = string.Format("<InputValue RefType='28' RefDate='{0}'/>", DateTime.Now.ToString("yyyy-MM-dd"));
                    CRefNo objRefNo = service.GetNextRefNo(inputValue);
                    trans[0].RefNo   = objRefNo.RefNo;
                    txtRefNo.Enabled = false;
                    pnDate.Enabled   = false;
                    isNew            = true;
                }
                else
                {
                    txtRefNo.Enabled = false;
                    pnDate.Enabled   = false;
                    isNew            = false;
                }
                txtRefNo.Text = trans[0].RefNo;

                SetRefDateTime(trans[0].RefDate);
                //txtRefDate.Value = trans[0].RefDate;


                txtRegisTransRefNo.Text = trans[0].RegisTransRefNo;
                //txtOldRefNo.Text = trans[0].OldRefNo;
                //txtAssetType.SelectedValue = trans[0].AssetType.ToString();
                //txtDirection.SelectedValue = trans[0].ObjectID.ToString();
                if (trans[0].WarranterID > 0)
                {
                    txtKHTX.SelectedValue = trans[0].WarranterID;
                    txtAddress.Text       = trans[0].WarranterAddress;
                }
                else if (trans[0].ID > 0)
                {
                    txtKHTX.Text    = trans[0].WarranterName;
                    txtAddress.Text = trans[0].WarranterAddress;
                }
                else
                {
                    if (waranter != null && waranter.Count > 0)
                    {
                        txtKHTX.Text    = waranter[0].ObjectName;
                        txtAddress.Text = waranter[0].ObjectAddress;
                    }
                }
                txtReason.Text = trans[0].Note;
                //txtVoucherActionType.SelectedValue = trans[0].Type.ToString();

                //txtObjectEmail.Text = trans[0].ObjectEmail;
                //txtWarranterEmail.Text = trans[0].WarranterEmail;
                //lbAttachName.Text = trans[0].FileNumber;
                CurrentTransaction = trans[0];
                //trans[0].Assets = assets;


                //SetAssetToGrid();
                //SetDefaultAssetName(grAsset);
                //SetDefaultAssetName(grAssetOther);
                //BindingSource Ownnersource = new BindingSource();
                //Ownnersource.DataSource = CurrentTransaction.AssetOwnnerList;
                //grAssetOwner.DataSource = Ownnersource;

                //BindingSource warrantersource = new BindingSource();
                //warrantersource.DataSource = CurrentTransaction.WarranterList;
                //grWarranter.DataSource = warrantersource;
            }
            //raise su kien de sua du lieu cot loai dang ky
            //txtVoucherActionType_SelectedIndexChanged(null, null);

            //Mac dinh check all
            if (ckSelectAssetHeader != null)
            {
                ckSelectAssetHeader.Checked = true;
                //ckSelectAssetHeader_CheckedChanged(null, null);
            }
        }