internal bool addReturnItem()
        {
            bool b = false;

            try {
                if (isValidForm())
                {
                    CompanyReturn companyReturn = new CompanyReturn();
                    companyReturn.BuyingInvoiceId = addCompanyReturn.BuyingInvoiceId;
                    companyReturn.ItemId          = addCompanyReturn.SelectedItem.Id;
                    companyReturn.Date            = addCompanyReturn.datePicker_date.SelectedValue;
                    companyReturn.Price           = addCompanyReturn.textBox_price.DoubleValue;
                    companyReturn.Quantity        = addCompanyReturn.textBox_quantity.DoubleValue;
                    CommonMethods.setCDMDForAdd(companyReturn);
                    if (add(companyReturn) > 0)
                    {
                        StockItem stockItem = stockManagerImpl.getStockItemByStockLocationIdAndItemId(Convert.ToInt32(Session.Preference["defaultCompanyReturnStock"]), addCompanyReturn.SelectedItem.Id);
                        stockItem.Quantity -= addCompanyReturn.textBox_quantity.DoubleValue;
                        CommonMethods.setCDMDForUpdate(stockItem);
                        stockManagerImpl.updStockItem(stockItem);
                        b = true;
                        loadAllReturnedItems();
                        resetAddForm();
                    }
                }
            } catch (Exception) {
            }
            return(b);
        }
        internal bool saveTransfer()
        {
            bool b = false;

            try {
                bool isOkay = true;
                if (addStockTransfer.textBox_carrierName_selectStock.IsNull())
                {
                    addStockTransfer.textBox_carrierName_selectStock.ErrorMode(true);
                    isOkay = false;
                }
                if (addStockTransfer.datePicker_date_selectStock.SelectedDate == null)
                {
                    addStockTransfer.datePicker_date_selectStock.ErrorMode(true);
                    isOkay = false;
                }
                if (Convert.ToInt32(addStockTransfer.comboBox_to_selectStock.SelectedValue) <= 0)
                {
                    addStockTransfer.comboBox_to_selectStock.ErrorMode(true);
                    isOkay = false;
                }
                if (Convert.ToInt32(addStockTransfer.comboBox_from_selectStock.SelectedValue) <= 0)
                {
                    addStockTransfer.comboBox_from_selectStock.ErrorMode(true);
                    isOkay = false;
                }
                if (Convert.ToInt32(addStockTransfer.comboBox_to_selectStock.SelectedValue) == Convert.ToInt32(addStockTransfer.comboBox_from_selectStock.SelectedValue))
                {
                    addStockTransfer.comboBox_from_selectStock.ErrorMode(true);
                    addStockTransfer.comboBox_to_selectStock.ErrorMode(true);
                    isOkay = false;
                }
                if (isOkay)
                {
                    if (addStockTransfer.DataTable.Rows.Count > 0)
                    {
                        StockTransfer stockTransfer = new StockTransfer();
                        stockTransfer.FromLocationId = Convert.ToInt32(addStockTransfer.comboBox_from_selectStock.SelectedValue);
                        stockTransfer.ToLocationId   = Convert.ToInt32(addStockTransfer.comboBox_to_selectStock.SelectedValue);
                        stockTransfer.Date           = Convert.ToDateTime(addStockTransfer.datePicker_date_selectStock.SelectedDate);
                        stockTransfer.Carrier        = addStockTransfer.textBox_carrierName_selectStock.TrimedText;
                        stockTransfer.Details        = addStockTransfer.textBox_details_selectStock.Text;
                        CommonMethods.setCDMDForAdd(stockTransfer);
                        int stockTransferId = addTransfer(stockTransfer);

                        StockTransferItem stockTransferItem = null;
                        StockItem         stockItemFrom     = null;
                        StockItem         stockItemTo       = null;
                        foreach (DataRow row in addStockTransfer.DataTable.Rows)
                        {
                            stockTransferItem = new StockTransferItem();
                            stockTransferItem.StockTransferId = stockTransferId;
                            stockTransferItem.ItemId          = Convert.ToInt32(row["ID"]);
                            stockTransferItem.Quantity        = Convert.ToDouble(row["Quantity"]);
                            CommonMethods.setCDMDForAdd(stockTransferItem);
                            stockItemFrom           = stockManagerImpl.getStockItemByStockLocationIdAndItemId(Convert.ToInt32(addStockTransfer.comboBox_from_selectStock.SelectedValue), Convert.ToInt32(row["ID"]));
                            stockItemTo             = stockManagerImpl.getStockItemByStockLocationIdAndItemId(Convert.ToInt32(addStockTransfer.comboBox_to_selectStock.SelectedValue), Convert.ToInt32(row["ID"]));
                            stockItemFrom.Quantity -= stockTransferItem.Quantity;
                            stockItemTo.Quantity   += stockTransferItem.Quantity;
                            addTransferItem(stockTransferItem);
                            stockManagerImpl.updStockItem(stockItemFrom);
                            stockManagerImpl.updStockItem(stockItemTo);
                        }
                        b = true;
                    }
                    else
                    {
                        ShowMessage.error(Common.Messages.Error.Error012);
                    }
                }
            } catch (Exception) {
            }
            return(b);
        }