protected void btnSave_Click(object sender, EventArgs e)
        {
            CompanyBank         item        = null;
            ICompanyBankService userService = IoC.Resolve <ICompanyBankService>();

            if (user_id > 0)//修改
            {
                item = userService.Get(this.user_id);
            }
            else
            {
                item = new CompanyBank();
            }

            if (string.IsNullOrEmpty(this.txtBankNo.Text))
            {
                Warning("请填写银行账号!");
                return;
            }
            if (string.IsNullOrEmpty(this.txtBankOwner.Text))
            {
                Warning("请填写开户人!");
                return;
            }

            var utag = this.drpBanks.SelectedValue;

            item.BankId    = int.Parse(utag.ToString());
            item.BankNo    = this.txtBankNo.Text;
            item.BankOwner = this.txtBankOwner.Text;
            item.Branch    = this.txtBranch.Text;
            item.IsEnable  = cmbStatus.SelectedValue == "1" ? true : false;
            item.OccDate   = DateTime.Now;
            item.Province  = this.txtProvince.Text;

            bool isCompled = false;

            if (user_id > 0)
            {
                userService.Save();
                isCompled = true;
            }
            else
            {
                isCompled = userService.Add(item);
            }
            if (isCompled)
            {
                JsAlert("保存成功!", true);
                this.txtBankNo.Text    = string.Empty;
                this.txtBankOwner.Text = string.Empty;
                this.txtBranch.Text    = string.Empty;
                this.txtProvince.Text  = string.Empty;
            }
            else
            {
                JsAlert("保存失败,请稍后再试!");
                //
            }
        }
Exemplo n.º 2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("ต้องการ บันทึกช้อมูล ", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
            {
                setCompany();
                String re  = xC.xtDB.copDB.insertCompany(cop, xC.userId);
                int    chk = 0;
                if (int.TryParse(re, out chk))
                {
                    for (int i = 1; i < grfCopBnk.Rows.Count; i++)
                    {
                        if (grfCopBnk[i, colBedit] == null)
                        {
                            continue;
                        }
                        if (grfCopBnk[i, colBedit].ToString().Equals("1"))
                        {
                            CompanyBank copb = new CompanyBank();
                            copb.comp_bank_id     = grfCopBnk[i, colBID] != null ? grfCopBnk[i, colBID].ToString() : "";
                            copb.comp_bank_name_t = grfCopBnk[i, colBBnkNameT] != null ? grfCopBnk[i, colBBnkNameT].ToString() : "";
                            copb.comp_bank_branch = grfCopBnk[i, colBBnkBranch] != null ? grfCopBnk[i, colBBnkBranch].ToString() : "";
                            copb.acc_number       = grfCopBnk[i, colBaccnumber] != null ? grfCopBnk[i, colBaccnumber].ToString() : "";
                            copb.remark           = grfCopBnk[i, colBRemark] != null ? grfCopBnk[i, colBRemark].ToString() : "";
                            copb.bank_id          = xC.iniDB.bnkDB.getIdByName(copb.comp_bank_name_t);
                            copb.comp_id          = txtID.Text;
                            xC.iniDB.copbDB.insertCompany(copb, xC.userId);
                        }
                    }
                }

                //setGrdView();
            }
        }
Exemplo n.º 3
0
        public String update(CompanyBank p, String userId)
        {
            String re = "", sql = "";

            chkNull(p);

            sql = "Update " + copB.table + " Set " +
                  " " + copB.comp_id + "='" + p.comp_id + "' " +
                  "," + copB.comp_bank_name_t + "='" + p.comp_bank_name_t.Replace("'", "''") + "' " +
                  "," + copB.comp_bank_branch + "='" + p.comp_bank_branch.Replace("'", "''") + "' " +
                  "," + copB.comp_bank_active + "='" + p.comp_bank_active.Replace("'", "''") + "' " +
                  "," + copB.acc_number + "='" + p.acc_number.Replace("'", "''") + "' " +
                  "," + copB.remark + "='" + p.remark.Replace("'", "''") + "' " +
                  "," + copB.date_modi + "=now() " +
                  "," + copB.user_modi + "='" + userId + "' " +
                  "," + copB.bank_id + "='" + p.bank_id + "' " +
                  "Where " + copB.pkField + "='" + p.comp_bank_id + "'"
            ;
            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }
Exemplo n.º 4
0
        public String insert(CompanyBank p, String userId)
        {
            String re = "", sql = "";

            p.active = "1";


            chkNull(p);
            sql = "Insert Into " + copB.table + "(" + copB.comp_id + "," + copB.comp_bank_name_t + "," + copB.comp_bank_branch + "," +
                  copB.comp_bank_active + "," + copB.acc_number + ", " + copB.remark + ", " +
                  copB.date_create + "," + copB.date_modi + ", " + copB.date_cancel + ", " +
                  copB.user_create + "," + copB.user_modi + ", " + copB.user_cancel + ", " +
                  copB.active + "," + copB.bank_id + " " +
                  ") " +
                  "Values ('" + p.comp_id + "','" + p.comp_bank_name_t.Replace("'", "''") + "','" + p.comp_bank_branch.Replace("'", "''") + "'," +
                  "'" + p.comp_bank_active.Replace("'", "''") + "','" + p.acc_number.Replace("'", "''") + "','" + p.remark.Replace("'", "''") + "'," +
                  "now(),'" + p.date_modi + "','" + p.date_cancel + "'," +
                  "'" + userId + "','" + p.user_modi + "','" + p.user_cancel + "'," +
                  "'" + p.active + "','" + p.bank_id + "' " +
                  ")";
            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }


            return(re);
        }
Exemplo n.º 5
0
        public IHttpActionResult PostCompanyBank(CompanyBank companyBank)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CompanyBanks.Add(companyBank);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (CompanyBankExists(companyBank.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = companyBank.ID }, companyBank));
        }
Exemplo n.º 6
0
        public IHttpActionResult PutCompanyBank(long id, CompanyBank companyBank)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != companyBank.ID)
            {
                return(BadRequest());
            }

            db.Entry(companyBank).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CompanyBankExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 7
0
        public C1ComboBox setC1CboItem(C1ComboBox c)
        {
            lexpn.Clear();
            ComboBoxItem item = new ComboBoxItem();
            DataTable    dt   = selectAll();
            //String aaa = "";
            ComboBoxItem item1 = new ComboBoxItem();

            item1.Text  = "";
            item1.Value = "000";
            c.Items.Clear();
            c.Items.Add(item1);
            //for (int i = 0; i < dt.Rows.Count; i++)
            foreach (DataRow row in dt.Rows)
            {
                item       = new ComboBoxItem();
                item.Text  = row[copB.comp_bank_name_t].ToString() + " " + row[copB.comp_bank_branch].ToString() + " " + row[copB.acc_number].ToString();
                item.Value = row[copB.comp_bank_id].ToString();
                c.Items.Add(item);

                CompanyBank expn1 = new CompanyBank();
                expn1.comp_bank_id     = row[copB.comp_bank_id].ToString();
                expn1.comp_bank_name_t = row[copB.comp_bank_name_t].ToString();
                expn1.comp_bank_branch = row[copB.comp_bank_branch].ToString();
                expn1.acc_number       = row[copB.acc_number].ToString();

                lexpn.Add(expn1);
            }
            return(c);
        }
Exemplo n.º 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            CompanyBank companyBank = db.CompanyBank.Find(id);

            db.CompanyBank.Remove(companyBank);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 9
0
        public IHttpActionResult GetCompanyBank(long id)
        {
            CompanyBank companyBank = db.CompanyBanks.Find(id);

            if (companyBank == null)
            {
                return(NotFound());
            }

            return(Ok(companyBank));
        }
Exemplo n.º 10
0
 public ActionResult Edit([Bind(Include = "Id,CompanyId,BankId,AccountName,AccountNo,Branch,SwiftCode,RoutingNo,BranchCode,Address,InitialBalance")] CompanyBank companyBank)
 {
     if (ModelState.IsValid)
     {
         db.Entry(companyBank).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BankId    = new SelectList(db.Bank, "Id", "Name", companyBank.BankId);
     ViewBag.CompanyId = new SelectList(db.Company, "Id", "Address", companyBank.CompanyId);
     return(View(companyBank));
 }
Exemplo n.º 11
0
        public CompanyBank selectByPk1(String copId)
        {
            CompanyBank cop1 = new CompanyBank();
            DataTable   dt   = new DataTable();
            String      sql  = "select copB.* " +
                               "From " + copB.table + " copB " +
                               //"Left Join t_ssdata_visit ssv On ssv.ssdata_visit_id = bd.ssdata_visit_id " +
                               "Where copB." + copB.comp_id + " ='" + copId + "' ";

            dt   = conn.selectData(conn.conn, sql);
            cop1 = setCompany(dt);
            return(cop1);
        }
Exemplo n.º 12
0
        public IHttpActionResult DeleteCompanyBank(long id)
        {
            CompanyBank companyBank = db.CompanyBanks.Find(id);

            if (companyBank == null)
            {
                return(NotFound());
            }

            db.CompanyBanks.Remove(companyBank);
            db.SaveChanges();

            return(Ok(companyBank));
        }
Exemplo n.º 13
0
        // GET: CompanyBanks/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CompanyBank companyBank = db.CompanyBank.Find(id);

            if (companyBank == null)
            {
                return(HttpNotFound());
            }
            return(View(companyBank));
        }
Exemplo n.º 14
0
        public String insertCompany(CompanyBank p, String userId)
        {
            String re = "";

            if (p.comp_bank_id.Equals(""))
            {
                re = insert(p, userId);
            }
            else
            {
                re = update(p, userId);
            }

            return(re);
        }
Exemplo n.º 15
0
        // GET: CompanyBanks/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CompanyBank companyBank = db.CompanyBank.Find(id);

            if (companyBank == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BankId    = new SelectList(db.Bank, "Id", "Name", companyBank.BankId);
            ViewBag.CompanyId = new SelectList(db.Company, "Id", "Address", companyBank.CompanyId);
            return(View(companyBank));
        }
Exemplo n.º 16
0
        public List <CompanyBank> FillCompanyBankList(string companyId)
        {
            var banks = new List <CompanyBank>();
            var i     = 0;

            while (true)
            {
                var bankName       = Request["group-bank[" + i + "][BankName]"];
                var branchNameCode = Request["group-bank[" + i + "][BranchNameCode]"];
                var accountNo      = Request["group-bank[" + i + "][AccountNo]"];
                var iban           = Request["group-bank[" + i + "][Iban]"];
                var swiftNo        = Request["group-bank[" + i + "][SwiftNo]"];
                var currencyType   = Request["group-bank[" + i + "][CurrencyType]"];
                var province       = Request["group-bank[" + i + "][Province]"];
                var district       = Request["group-bank[" + i + "][District]"];
                var bankId         = Request["group-bank[" + i + "][BankId]"];

                if (string.IsNullOrWhiteSpace(bankName) || string.IsNullOrWhiteSpace(branchNameCode) || string.IsNullOrWhiteSpace(accountNo) || string.IsNullOrWhiteSpace(currencyType))
                {
                    break;
                }
                var bank1 = new CompanyBank();
                var temp  = bankName.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                //bank1.BankNameTermName = temp[1];
                var temp1 = branchNameCode.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
                bank1.BranchCode     = temp1[1].Trim();
                bank1.BranchName     = temp1[0].Trim();
                bank1.AccountNo      = accountNo;
                bank1.District       = district;
                bank1.Province       = province;
                bank1.Iban           = iban;
                bank1.Id             = bankId.AsInt();
                bank1.BankNameTermId = int.Parse(temp[0]);
                bank1.SwiftNo        = swiftNo;
                bank1.CompanyId      = companyId;
                //bank1.EntityId = entityId;
                //bank1.EntityType = (int)entityType;
                var tempCurrencyTypeParts = currencyType.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                bank1.CurrencyTypeTermId = int.Parse(tempCurrencyTypeParts[0]);
                //bank1.CurrencyTypeTermName = tempCurrencyTypeParts[1];
                //bank1.CreatedOn = DateTime.Now;
                banks.Add(bank1);
                i++;
            }
            return(banks);
        }
Exemplo n.º 17
0
        private CompanyBank setCompany(DataTable dt)
        {
            CompanyBank cop1 = new CompanyBank();

            if (dt.Rows.Count > 0)
            {
                cop1.comp_bank_id     = dt.Rows[0][copB.comp_bank_id].ToString();
                cop1.comp_id          = dt.Rows[0][copB.comp_id].ToString();
                cop1.comp_bank_name_t = dt.Rows[0][copB.comp_bank_name_t].ToString();
                cop1.comp_bank_branch = dt.Rows[0][copB.comp_bank_branch].ToString();
                cop1.comp_bank_active = dt.Rows[0][copB.comp_bank_active].ToString();
                cop1.acc_number       = dt.Rows[0][copB.acc_number].ToString();
                cop1.remark           = dt.Rows[0][copB.remark].ToString();
                cop1.date_create      = dt.Rows[0][copB.date_create].ToString();
                cop1.date_modi        = dt.Rows[0][copB.date_modi].ToString();
                cop1.date_cancel      = dt.Rows[0][copB.date_cancel].ToString();
                cop1.user_create      = dt.Rows[0][copB.user_create].ToString();
                cop1.user_modi        = dt.Rows[0][copB.user_modi].ToString();
                cop1.user_cancel      = dt.Rows[0][copB.user_cancel].ToString();
                cop1.active           = dt.Rows[0][copB.active].ToString();
                cop1.bank_id          = dt.Rows[0][copB.bank_id].ToString();
            }
            else
            {
                cop1.comp_bank_id     = "";
                cop1.comp_id          = "";
                cop1.comp_bank_name_t = "";
                cop1.comp_bank_branch = "";
                cop1.comp_bank_active = "";
                cop1.acc_number       = "";
                cop1.remark           = "";
                cop1.date_create      = "";
                cop1.date_modi        = "";
                cop1.date_cancel      = "";
                cop1.user_create      = "";
                cop1.user_modi        = "";
                cop1.user_cancel      = "";
                cop1.active           = "";
                cop1.bank_id          = "";
            }

            return(cop1);
        }
Exemplo n.º 18
0
        private void chkNull(CompanyBank p)
        {
            int     chk  = 0;
            Decimal chk1 = 0;

            p.date_modi        = p.date_modi == null ? "" : p.date_modi;
            p.date_cancel      = p.date_cancel == null ? "" : p.date_cancel;
            p.user_create      = p.user_create == null ? "" : p.user_create;
            p.user_modi        = p.user_modi == null ? "" : p.user_modi;
            p.user_cancel      = p.user_cancel == null ? "" : p.user_cancel;
            p.comp_id          = p.comp_id == null ? "" : p.comp_id;
            p.comp_bank_name_t = p.comp_bank_name_t == null ? "" : p.comp_bank_name_t;
            p.comp_bank_active = p.comp_bank_active == null ? "" : p.comp_bank_active;
            p.acc_number       = p.acc_number == null ? "" : p.acc_number;
            p.remark           = p.remark == null ? "" : p.remark;
            p.active           = p.active == null ? "" : p.active;
            //p.bank_id = p.bank_id == null ? "" : p.bank_id;
            //p.inv_line2 = p.inv_line2 == null ? "" : p.inv_line2;
            //p.inv_line4 = p.inv_line4 == null ? "" : p.inv_line4;


            p.bank_id = int.TryParse(p.bank_id, out chk) ? chk1.ToString() : "0";
        }
Exemplo n.º 19
0
        private void initConfig()
        {
            copB = new CompanyBank();
            copB.comp_bank_id     = "comp_bank_id";
            copB.comp_id          = "comp_id";
            copB.comp_bank_name_t = "comp_bank_name_t";
            copB.comp_bank_branch = "comp_bank_branch";
            copB.comp_bank_active = "comp_bank_active";
            copB.acc_number       = "acc_number";
            copB.remark           = "remark";
            copB.date_create      = "date_create";
            copB.date_modi        = "date_modi";
            copB.date_cancel      = "date_cancel";
            copB.user_create      = "user_create";
            copB.user_modi        = "user_modi";
            copB.user_cancel      = "user_cancel";
            copB.active           = "active";
            copB.bank_id          = "bank_id";

            copB.table   = "b_company_bank";
            copB.pkField = "comp_bank_id";

            lexpn = new List <CompanyBank>();
        }