private void LockUnlockForSelling(string UnLock = "") { bool isLock = false; if (UnLock == "Unlock") { isLock = false; } else if (cmdLockUnlockProduct.ToolTip == "unlock") { isLock = true; } Products clsProducts = new Products(); clsProducts.LockUnlockForSellingByProductSubGroup(Int32.Parse(cboBranch.SelectedItem.Value), Int64.Parse(cboProductSubGroup.SelectedItem.Value), isLock); clsProducts.CommitAndDispose(); if (!isLock) { cmdLockUnlockProduct.Text = "Lock Product Sub Group [<label class='ms-error'>Note:</label>Products under this subgroup are <u>CURRENTLY ALLOWED</u> for Selling]"; cmdLockUnlockProduct.ToolTip = "unlock"; } else { cmdLockUnlockProduct.Text = "UnLock Product Sub Group [<label class='ms-error'>Note:</label>Products under this subgroup are <u>CURRENTLY NOT ALLOWED</u> for Selling]"; cmdLockUnlockProduct.ToolTip = "lock"; } }
private string CloseInventory() { string strRetValue = ""; try { DateTime DeliveryDate = Convert.ToDateTime(txtClosingDate.Text); ERPConfig clsERPConfig = new ERPConfig(); ERPConfigDetails clsERPConfigDetails = clsERPConfig.Details(); if (clsERPConfigDetails.PostingDateFrom <= DeliveryDate && clsERPConfigDetails.PostingDateTo >= DeliveryDate) { string strReferenceNo = Constants.CLOSE_INVENTORY_CODE + CompanyDetails.BECompanyCode + DateTime.Now.Year.ToString() + clsERPConfig.get_LastClosingNo(); AccessUserDetails clsAccessUserDetails = (AccessUserDetails)Session["AccessUserDetails"]; ProductInventories clsProductInventories = new ProductInventories(clsERPConfig.Connection, clsERPConfig.Transaction); clsProductInventories.CloseInventoryByProductSubGroup(int.Parse(cboBranch.SelectedItem.Value), clsAccessUserDetails.UID, DateTime.Parse(txtClosingDate.Text), strReferenceNo, long.Parse(cboProductSubGroup.SelectedItem.Value), cboProductSubGroup.SelectedItem.Text); Products clsProducts = new Products(clsERPConfig.Connection, clsERPConfig.Transaction); clsProducts.LockUnlockForSellingByProductSubGroup(int.Parse(cboBranch.SelectedItem.Value), long.Parse(cboProductSubGroup.SelectedItem.Value), false); clsERPConfig.CommitAndDispose(); strRetValue = strReferenceNo; } else { clsERPConfig.CommitAndDispose(); string stScript = "<Script>"; stScript += "window.alert('Sorry you cannot close using the closing date: " + txtClosingDate.Text + ". Please enter an allowable posting date.')"; stScript += "</Script>"; Response.Write(stScript); } } catch (Exception ex) { string stScript = "<Script>"; stScript += "window.alert('An error has occured while closing the inventory. Details:' " + ex.Message + ")"; stScript += "</Script>"; Response.Write(stScript); } return strRetValue; }