private List <InfoRefList> GetRefList(int AD_Reference_ID, Ctx ctx) { //String sql = "SELECT Value, Name FROM AD_Ref_List " // + "WHERE AD_Reference_ID=" + AD_Reference_ID + " AND IsActive='Y' ORDER BY 1"; //DataSet ds = null; List <InfoRefList> list = new List <InfoRefList>(); try { ValueNamePair[] refList = MRefList.GetList(AD_Reference_ID, true, ctx); //ds = DB.ExecuteDataset(sql, null, null); InfoRefList itm = null; // new InfoRefList(); // itm.Key = ""; // itm.Value = ""; // list.Add(itm); for (int i = 0; i < refList.Length; i++) { itm = new InfoRefList(); itm.Key = refList[i].GetKeyID().ToString(); //["Value"].ToString(); itm.Value = refList[i].GetValue(); // ds.Tables[0].Rows[i]["Name"].ToString(); list.Add(itm); } refList = null; } catch (Exception) { } return(list); }
/// <summary> /// Get Dimension Type /// </summary> /// <param name="ctx">Context</param> /// <returns>List of Dimension Type</returns> public List <InfoRefList> GetDimensionType(Ctx ctx) { List <InfoRefList> list = new List <InfoRefList>(); int Reference_ID = Convert.ToInt32(VAdvantage.DataBase.DB.ExecuteScalar("SELECT AD_Reference_Value_ID FROM AD_Column WHERE Export_ID='VIS_2663'")); ValueNamePair[] refList = MRefList.GetList(Reference_ID, true, ctx); InfoRefList itm = null;// new InfoRefList(); // itm.Key = ""; // itm.Value = ""; // list.Add(itm); for (int i = 0; i < refList.Length; i++) { if (refList[i].GetKeyID().ToString() != "") { itm = new InfoRefList(); itm.Key = refList[i].GetKeyID().ToString(); //["Value"].ToString(); itm.Value = refList[i].GetName(); // ds.Tables[0].Rows[i]["Name"].ToString(); list.Add(itm); } } refList = null; return(list); }
/// <summary> /// Получение всех ИД в ПНР для допуслуг на определенных мульти-сегментах /// </summary> /// <param name="segmentRefs">Мульти-ссылки на сегменты</param> /// <returns></returns> public List <string> GetIDInPNRFor(MRefList <int> segmentRefs) { var result = new List <string>(); foreach (var segmentRef in segmentRefs) { result.AddRange(GetIDInPNRFor(segmentRef)); } return(result); }
private FileLocation GetFileLocations(Ctx ctx) { //MAttachment att = new MAttachment(ctx, AD_Table_ID, Record_ID, null); //return att; FileLocation locations = new FileLocation(); int AD_Reference_ID = Util.GetValueOfInt(DB.ExecuteScalar("Select AD_Reference_Value_ID from ad_Column WHERE AD_Table_ID =(SELECT AD_Table_ID FROM AD_Table WHERE TableName='AD_ClientInfo') AND UPPER(ColumnName)='SAVEATTACHMENTON'", null, null)); locations.values = MRefList.GetList(AD_Reference_ID, false, ctx); locations.selectedvalue = Util.GetValueOfString(DB.ExecuteScalar("Select SAVEATTACHMENTON From AD_CLientInfo WHERE Ad_client_ID=" + ctx.GetAD_Client_ID(), null, null)); return(locations); }
/** * Get Name of ConfirmType * @return confirm type */ public String GetConfirmTypeName() { return(MRefList.GetListName(GetCtx(), CONFIRMTYPE_AD_Reference_ID, GetConfirmType())); }
/// <summary> /// Move stock to location /// </summary> /// <param name="target">storage</param> /// <returns>no of movements</returns> private int Move(MStorage target) { log.Info(target.ToString()); Decimal qty = Decimal.Negate(target.GetQtyOnHand());//.negate(); // Create Movement MMovement mh = new MMovement(GetCtx(), 0, Get_Trx()); mh.SetC_DocType_ID(_C_DocType_ID); mh.SetDescription(GetName()); if (!mh.Save()) { return(0); } int lines = 0; MStorage[] sources = GetSources(target.GetM_Product_ID(), target.GetM_Locator_ID()); for (int i = 0; i < sources.Length; i++) { MStorage source = sources[i]; // Movement Line MMovementLine ml = new MMovementLine(mh); ml.SetM_Product_ID(target.GetM_Product_ID()); ml.SetM_LocatorTo_ID(target.GetM_Locator_ID()); ml.SetM_AttributeSetInstanceTo_ID(target.GetM_AttributeSetInstance_ID()); // From ml.SetM_Locator_ID(source.GetM_Locator_ID()); ml.SetM_AttributeSetInstance_ID(source.GetM_AttributeSetInstance_ID()); Decimal qtyMove = qty; if (qtyMove.CompareTo(source.GetQtyOnHand()) > 0) { qtyMove = source.GetQtyOnHand(); } ml.SetMovementQty(qtyMove); // lines++; ml.SetLine(lines * 10); if (!ml.Save()) { return(0); } qty = Decimal.Subtract(qty, qtyMove); if (Env.Signum(qty) <= 0) { break; } } // for all movements // Process //mh.ProcessIt(MMovement.ACTION_Complete); mh.ProcessIt(DocActionVariables.ACTION_COMPLETE); mh.Save(); AddLog(0, null, new Decimal(lines), "@M_Movement_ID@ " + mh.GetDocumentNo() + " (" + MRefList.Get(GetCtx(), MMovement.DOCSTATUS_AD_Reference_ID, mh.GetDocStatus(), Get_Trx()) + ")"); EliminateReservation(target); return(lines); }