private double GetLastLotNo()
 {
     if (!string.IsNullOrEmpty(baseAddEditMasterDetail.FormKeyCode) && ddlWarehouseDetails.SelectedIndex != 0)
     {
         PhyLot entity = new PhyLot() { warehouse_id = ddlWarehouseDetails.SelectedValue.ToLong(), material_id = baseAddEditMasterDetail.FormKeyCode.ToLong() };
         return ServiceProvider.PhyLotService.GetCurrentLotNo(entity) + 1;
     }
     return 1;
 }
        private void btnLoadPortFolio_Click(object sender, EventArgs e)
        {
            object result = base.OpenPopup<InPortfolio>();
            if (result != null)
            {
                DataSet dsPortfolioDetail = (DataSet)result;

                if (dsPortfolioDetail.Tables.Count > 0)
                {
                    foreach (DataRow dr in dsPortfolioDetail.Tables[0].Rows)
                    {
                        DataRow newRow = this.dsTranDetail.Tables[0].NewRow();
                        if (!string.IsNullOrEmpty(base.FormKeyCode))
                        {
                            newRow["tran_head_id"] = base.FormKeyCode.ToLong();
                        }
                        newRow["material_code"] = dr["material_code"];
                        newRow["material_id"] = dr["material_id"];
                        newRow["warehouse_id_dest"] = dr["warehouse_id"];
                        newRow["Quantity"] = 0;
                        newRow["Remark"] = "";
                        newRow["Material"] = dr["material_name"];
                        newRow["warehouse_id_dest"] = dr["warehouse_id"];
                        newRow["Warehouse"] = dr["warehouse_name"];

                        PhyLot entityPhyLot = new PhyLot() { warehouse_id = newRow["warehouse_id_dest"].ToLong(), material_id = newRow["material_id"].ToLong() };
                        newRow["Lot No."] = (ServiceProvider.PhyLotService.GetCurrentLotNo(entityPhyLot) + 1);
                        newRow["UOM"] = dr["uom_name"];
                        this.dsTranDetail.Tables[0].Rows.Add(newRow);
                    }

                    baseGridDetail.LoadData();
                }
            }
        }
 private double GetLastLotNo()
 {
     if (ddlMaterial.SelectedIndex != 0 && ddlWarehouseDetails.SelectedIndex != 0)
     {
         PhyLot entity = new PhyLot() { warehouse_id = ddlWarehouseDetails.SelectedValue.ToLong(), material_id = ddlMaterial.SelectedValue.ToLong() };
         return ServiceProvider.PhyLotService.GetCurrentLotNo(entity) + 1;
     }
     return 1;
 }